setting font color of <a> inside a li tag

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.


<style>
  div.c1 li.c2 a { color: red; }
</style>

The most specific CSS selectors would probably be

div.c1 > li.c2 > a:link,
div.c1 > li.c2 > a:active,
div.c1 > li.c2 > a:hover,
div.c1 > li.c2 > a:visited {
    color: red;
}

The more specific the CSS selectors, the less work for the browser's rendering engine.

However, something is wrong with your markup if this is supposed to be HTML and the <li> element's parent is a <div> instead of <ol> or <ul>.


<div class="c1">
      <li class="c2"><a href="">blah</a></li>
</div>
<style>
  div.c1 li.c2 a { color: red; }
</style>

Tags:

Css