specificity

What's the best way to create a style reset for only a portion of the DOM?

I'm trying to create a css reset that targets only my control. So the HTML will look something like this: <body> <img class="outterImg" src="sadkitty.gif" /> <div id="container" class="container"> <img class="innerImg" src="sadkitty.gif" /> <div class="subContainer"> <img class="innerImg" src="sadkitty.gif" /> </di...

Using two css files in the same html file

Is it possible to use 2 CSS classes that have the same name for the selectors, etc. in the same HTML file? If so, how do you differentiate between the two when styling elements? ...

Optimize CSS: Narrow Definition (#mytable tbody span.myclass) better?

Hello, I wondered whether or not a 'narrow' definition such as #mytable tbody span.myclass { color: #ffffff; } is better/faster to parse than just .myclass { color: #ffffff; } I read somewhere that narrow definitions supposedly actually have some kind of adversery effect on CSS speed, but I can't remember where a...

Css specificity :last-child

I would like to use the following to target the last link (a) of the last ul inside my div. So this is what came to mind: #menu ul:last-child li a { /*.....*/ } I cant manually add a class to that element, and even if i wanted to do it dynamically i would still have to target the element the above way. Any ideas why this is no...

Change specificity by child

hi I'd like to integrate a theme tag to my elements so they appear in diffrent colours. But since the css selectors have the same css specificity the latest overrides the earlier defined rule. this is an example that shows my problem: .... <div class="red"> <div class="box">This should be red</div> <div class="yellow"> ... ...

Points in CSS specificity

Researching specificity I stumbled upon this blog - http://www.htmldog.com/guides/cssadvanced/specificity/ It states that specificity is a point-scoring system for CSS. It tells us that elements are worth 1 point, classes are worth 10 points and IDs are worth 100 points. It also goes on top say that these points are totaled and the ove...

CSS question - Specificity and interitance

Why in the following code world is blue rather than red ? The specificity of .my_class is 0,0,1,0, but it inherits the color of #my_id which specificity is higher (0,1,0,0). HTML: <p id='my_id'> Hello <span class='my_class'> world </span> </p> CSS: #my_id { color: red; } .my_class { color: blue; } ...

IE ignoring CSS even though it has higher specificity.

I have some sliding door button css.. I use a button tag and two inner spans. I have this to specify the background image of a normal button; button span { background: url(button_right.png) no-repeat top right; } Which is the default button colour. I then have a 'gray' button (i give the button a class of 'gray'). button.gray span ...