Posted by Toby Inkster on 04/25/06 10:09
gil wrote:
> The order of specifying the styles determines which ones will be used.
> The last style specified for an element will be the one used.
That's not entirely true. Specificity is also a key factor. For example:
<style type="text/css">
#green { color: green }
#green2 { color: green }
.red { color: red }
</style>
<p id="green" class="red">
I am green.
</p>
The ID selector is more specific than the class selector, so gets applied
to the paragraph.
More on specificity here:
http://www.w3.org/TR/CSS21/cascade.html#specificity
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|