In which order are CSS styles applied?

Posted by citronas on Stack Overflow See other posts from Stack Overflow or by citronas
Published on 2010-05-13T11:34:37Z Indexed on 2010/05/13 11:44 UTC
Read the original article Hit count: 252

Filed under:
|
|
|

I have the following HTML.

<ul>
  <li>
    <a>asdas</a>
  </li>
</ul>

In my CSS stylesheet I have general settings for the a tag, and several hundered lines later settings for ul li a. Like this:

a:link
{
 color: red;
}
...
ul li a
{
 color:blue;
}

Firebug tells me, that first the color:blue is loaded, and afterwards overriden by color:red
So far I've always thought, that the order of loading css files and the order of style inside a single css file tell the browser how html elements should be formatted. Unfortunately I'm now experiencing it vice versa.

So tell me, how must I correct my style to achieve the a tag inside the li to be rendered blue and not red?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#