Log in

View Full Version : Resolved IE 8 conditional



bluewalrus
06-21-2009, 03:12 AM
I'm trying to put a conditional statement in for ie 8, 7, and 6 but it is not working currently. It doesn't read it at all regardless of the code inside. I'm assuming I'm doing it wrong. I only have 8 though so maybe it's just that they changed the conditional statment? This is the simplest version of my code. Also if the regular page has <style type="text/css">css stuff can i just put the conditional in the middle here?</style>or does it have to go outside here? Thanks.



<!--[if IE]>
<style type="text/css">
body {
background:#00ff00;
}
</style>
<![endif]-->

Rando
06-22-2009, 01:37 PM
It goes outside the <style></style> tags of your original style sheet :)

Example:


<link rel="stylesheet" type="text/css" href="URL" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="URL" />
<![endif]-->

Rando

bluewalrus
06-22-2009, 08:57 PM
That would be if I were using different style sheets though. Would it work like this...


<style type="text/css">
* {
margin:0;
border:0;
}
#page_article {
}
#page_main {
width:59.3em;
background:#FFFFFF;
margin:auto;
}
<!--[if IE]>
#page_main {
width:59.3em;
background:#00FF00;
margin:auto;
}
<![endif]-->
</style>

or this...


<style type="text/css">
* {
margin:0;
border:0;
}
#page_article {
}
#page_main {
width:59.3em;
background:#FFFFFF;
margin:auto;
}
</style>
<!--[if IE]>
<style type="text/css">
#page_main {
width:59.3em;
background:#00FF00;
margin:auto;
}
</style>
<![endif]-->

molendijk
06-22-2009, 09:27 PM
You must use the second method. To distinguish between different IE versions, you can do things like:

<!--[if IE]>
You are using Internet Explorer
<![endif]-->

<!--[if IE 5]>
IE5
<![endif]-->

<!--[if IE 5.0]>
IE5.0
<![endif]-->

<!--[if IE 5.5]>
IE5.5
<![endif]-->

<!--[if IE 6]>
IE6
<![endif]-->

<!--[if IE 7]>
IE7
<![endif]-->

<!--[if IE 8]>
IE8
<![endif]-->

<!--[if !IE]><!-->
Not IE
<!--<![endif]-->

<!--[if IE 6]><!-->
EITHER IE6 OR a non-IE
<!--<![endif]-->

<!--[if lt IE 7]>
<![if gte IE 5.5]>
IE>=5.5. and <7
<![endif]>
<![endif]-->

etc.
===
Arie Molendijk.

bluewalrus
06-23-2009, 05:16 AM
oo alright thanks.