Selector specificity for the more unusual selector types

Hello!


I've got a small wondering about the specificity of some selectors, namely 
the attribute selectors [class~="blah"] and [id="blah"], since those are, 
at least in what element they affect equal to the .blah and #blah 
selectors. Are all attribute selectors of the same specificity, or does the 
specificity differ depending on what attribute you look at? If it's equal 
for all attribute selectors, is there any way to raise the specificity of 
[id="blah"] to that of #blah?


#blah2 #blah             { /* Specificity 2,0,0 */
                          color: blue;
                          }

#blah                    { /* Specificity 1,0,0 */
                          color: red;
                          }

[id="blah2"] [id="blah"] { /* Specificity 0,2,0 or 2,0,0? */
                          color: green;
                          }

[id="blah"]              { /* Specificity 0,1,0 or 1,0,0? */
                          color: yellow;
                          }

[id="blah2"] [id="blah"] { /* Specificity ? (Does this overrule the next 
rule?)*/
                          color: maroon !important;
                          }

[id="blah"]              { /* Specificity ? */
                          color: olive !important;
                          }


<div id="blah2">
   <div id="blah">
     content
   </div>
</div>

Will "content" take the colour maroon or olive?
// Liorean

Received on Saturday, 25 May 2002 10:40:01 UTC