...

View Full Version : specifity



_com
08-23-2005, 10:01 PM
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 ... ?

eak
08-23-2005, 10:35 PM
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/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum