25, 2005
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hope Stewart
Sent: Saturday, 23 July 2005 5:41 PM
To: Web Standards Group
Subject: [WSG] Understanding inheritance (well, trying to)
There's something about inheritance that I don't understand. Say
inheritance (well, trying to)
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
] Understanding inheritance (well, trying to)
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
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
Hope,
This second rule of yours is not being applied as it has less weight than
the first rule.
This is due to specificity. Specificity is used to determine which rules
will be applied to elements if there are conflicts - such as different color
properties being applied to the p element.
Your
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:
Thanks Russ Joe. It all makes sense now! I had never come across the
specificity rules before. (Then again, a year ago I had never heard of web
standards.) This is a rather handy thing to know.
Cheers,
Hope Stewart
**
The discussion list for