PDA

View Full Version : IE conditional comments



rmedek
Nov 21st, 2004, 11:44 PM
I need a little clarification here...

If I use IE's conditional comments to deliver a separate stylesheet to IE, will that override any declarations I made in the normal stylesheet?

Or would I still have to hide info from IE in the normal stylesheet, using "html>body" hacks or something similiar?

Any help is appreciated, as always...

Antoniohawk
Nov 22nd, 2004, 12:12 AM
No need to use html>foo as far as I know. :) Check this out. [http://www.virtuelvis.com/archives/158.html]

hemebond
Nov 22nd, 2004, 12:19 AM
As long as you include the IE-specific stylesheet after the others, it will be cascaded over the top, overwriting any previously specified values.

gohankid77
Nov 22nd, 2004, 12:20 AM
html>body isn't considered a hack per se, but a more specific way to target something (in this case, the BODY element).



<!--[if gte IE 5.5]>
<style type="text/css">
<!--
.floatbox {
float: left;
width: 150px;
height: 150px;
margin: 5px 0 5px 50px;
/*This last value applies the 100px left margin in IE though it only says 50px*/
}
-->
</style>
<![end if]-->

<style type="text/css">
<!--
div>.floatbox {
float: left;
width: 150px;
height: 150px;
margin: 5px 0 5px 100px;
/*This last value applies the 100px left margin */
}
-->
</style>


I duplicated the IE Doubled Float-Margin Bug from /*PIE*/ (http://www.positioniseverything.net/explorer/doubled-margin.html) and modified it. I didn't test what I coded, but it illustrates the example. I think IE by default ignores properties that it finds after the IE conditional comment block though. I'm not 100% sure.

Edit: My code works. Just give non-WinIE browsers higher specificity as I showed.

rmedek
Nov 22nd, 2004, 01:34 AM
Cool, thanks for the info guys :)

Basscyst
Nov 24th, 2004, 01:56 AM
:eek:
Deep breaths Willy,

OOOOOHHHHHMMMMMM. . . .OOOOOHHHHHHMMMM.

Basscyst

sage45
Nov 25th, 2004, 03:18 AM
I am closing this thread as it has been answered.

To Willy and rmedek:

If you wish to bicker back and forth these boards are not the place for it. You can use email, MSN or any other program that you see fit.

-sage-