mrblah mrblah - 1 year ago 99
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download