Is this possible without introducing Javascript or adding to HTML?

My client wants every list of links, i.e. each form list

<ul>
    <li>
        <a href="www.google.com">Here a link</a>  
    </li>
    <li>
        <a href="www.google.com">Here a link</a>          
    </li>
    <li>
        <a href="www.google.com">Here a link</a>          
    </li>
</ul>

so that the bullets of the list are the same color as the linked text, but each list is without links, that is, each list of the form

<ul>
     <li>Here a regular list item</li>   
     <li>Here a regular list item</li>
     <li>Here a regular list item</li>
</ul>

must have its bullets and the corresponding text as usual.

Fiddle: http://jsfiddle.net/0kkc2rz4/

I am limited to not being able to add classes to HTML, so something like

<ul class='link-list'>
    <li>
        <a href="www.google.com">Here a link</a>  
    </li>
    <li>
        <a href="www.google.com">Here a link</a>          
    </li>
    <li>
        <a href="www.google.com">Here a link</a>          
    </li>
</ul>

ul.link-list li { color: #004E98; }

there can be no question, although I understand that, obviously, the best way to do this is if I encoded the site from scratch. I can add JS, but would prefer not to.

+4
source share
2 answers

, . , "" a li, , .

ul{
  margin:0em;
  padding:0em;
  list-style:none;
  padding:20px 20px 0px 20px;
  font-family:sans-serif;
}


li{
  margin:0em;
  padding:0em;
  padding-bottom:10px;
}

a{
  color:red;
  text-decoration:none;
}

a:hover{
  color:green;
}

a, li{
  position:relative;
}

a:before, li:before{
  content:'\2022';
  position:absolute;
  left:-0.5em; 
  color:inherit;
}
<ul>
    <li>
        <a href="www.google.com">Here a link</a>  
    </li>
    <li>
        <a href="www.google.com">Here a link</a>          
    </li>
    <li>
        Here a regular list item       
    </li>
</ul>
+6

: http://jsfiddle.net/2acw2hae/1/

ul { list-style: none; }

ul a { position: relative; }

ul a:before { 
    content : "\25CF"; /* unicode for black circle */
    font-size: 0.75em; 
    margin-right: .5em;
}

/* this overlaps the text-decoration under the bullet */
ul a:after { 
    content : "";
    position: absolute; 
    bottom: 0; left: 0; 
    height:4px; 
    width: .5em; 
    background: #fff; 
}

enter image description here

+1

All Articles