views:

69

answers:

1

Should it always come after main css or place doesn't matter?

For example:

if DIV {width:500px} is specified in main.css and DIV {width:400px} is specfied in IEonly.css which is inside Conditional comment.

Then is it must that, IEonly.css should come after main.css in source , or placement doesn't matter?

+3  A: 

Placement of style sheets always matters in CSS, conditional comments make no difference. If a style rule targeting an identical selector (*) occurs multiple times, the last one will take precedence.

So you need to include browser specific style sheets after the main style sheet, otherwise the main style sheet will overwrite the browser specific instructions.

(*) It's a bit more complicated when you have different selectors like div.classname and, say, body.classname div.container div.classname - then the more specific selector wins. More in the chapter "6.3 calculating selector specifity" in here.

Pekka
ok thanks i thought main style-sheet will never override on browser specific style sheet.
metal-gear-solid
Thanks for more info
metal-gear-solid