mrblah mrblah - 7 months ago 27
CSS Question

setting font color of <a> inside a li tag

My markup looks like:

<div class="c1">
<li class="c2"><a href="">blah</a></li>

I want the text blah to be red.

c1 is used other places, so I want to drill down as much as possible without affecting other markup.


Use this style definition in your css-file:

div.c1 li.c2 a {
  color: red;

PS: Having your <li> tag inside your <div>-tag without an <ul>-tag is not recommended.