SitePoint
Reference
CSS
The Cascade, Specificity, and Inheritance
Specificity
CSS Live Demo: Specificity
(this page)
See also:
All Live Demos
CSS Live Demo: Specificity
Type your
CSS
here:
(any properties allowed except expression, behavior and @import)
p { color:black; background-color:white; } div.warning p { color:red; background:white; } div#caution p { color:yellow; background:black; } html, body { background:gray; }
Type your
HTML
here:
(any tags allowed except script, iframe, frame, object, img and embed)
<div class="warning" id="caution"> <p>Nowhere will you find a more wretched hive of scum and villainy ... we must be cautious.</p> </div>
Show me!
Your results appear here: