CSS Rule Priorities

Posted by Antilogic on Stack Overflow See other posts from Stack Overflow or by Antilogic
Published on 2010-05-20T18:09:16Z Indexed on 2010/05/20 18:10 UTC
Read the original article Hit count: 145

Filed under:

Given the following mark-up...

<div id="Header">
     <a href="#" class="Highlight">foo</a>
</div>

And the following stylesheet...

/******************Exceptions******************/
#Footer, #Header,
#Footer a, #Header a { color: #f8f8f8; }


/******************Classes******************/
.Highlight, a.Highlight { color: #B1D355; }
.Notification, a.Notification { color: Red; }

Why is my link still off-white (F8F8F8) rather than green (B1D355)?

Shouldn't using the class Highlight override the color settings for Header and Footer since it comes after their declarations?

© Stack Overflow or respective owner

Related posts about css