View Full Version : specifity
Is this css declaration ...
div#firstDivie ul#unorderListlistOfFirstDivie li {
height: 50px;
}
the same as the one here under:
ul#unorderListlistOfFirstDivie li {
height: 50px;
}
Is the first one on higher specifity ... ?
Since your using ID's I would use the second one. There should only be one element per ID so those 2 do the same thing.
hemebond
08-23-2005, 10:40 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>66589</title>
<style type="text/css">
div#firstDivie ul#unorderListlistOfFirstDivie li
{
color:#f00;
}
ul#unorderListlistOfFirstDivie li
{
color:#0f0;
}
</style>
</head>
<body>
<div id="firstDivie">
<ul id="unorderListlistOfFirstDivie">
<li>
This text should show what selector has higher specifity.
</li>
</ul>
</div>
</body>
</html>This shows the first has higher specifity.
]|V|[agnus
08-23-2005, 10:57 PM
This shows the first has higher specifity.
And does nothing to explain why! :thumbsup: Typical hemebondian post, no big deal.
Check these out:
http://www.w3.org/TR/CSS21/cascade.html
http://www.htmldog.com/guides/cssadvanced/specificity/
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.