Hello,

This has to do with specificity. The use of the id in #hilite p is a more specific rule than the class in .normal.

When you re-write it to #hilite .normal that rule now becomes more specific. An id is more specific than a class.

For more on this:

http://www.htmldog.com/guides/cssadvanced/specificity/

Hope Stewart wrote:
There's something about inheritance that I don't understand. Say in my style
sheet I have:

body { color: black }
#content {}
#hilite p { color: red }

If I have three paragraphs in the div #hilite and I want the text of one of
them to be black instead of red, I define this class for that paragraph:

.normal { color: black }.

But I find this doesn't work. For it to work, I have to define the class
with the div ID, like this:

#hilite .normal { color: black }

What is it about the laws of inheritance that means the class alone won't
work??

Hope Stewart
******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************

Reply via email to