CSS + IF Statement

Soldato
Joined
12 Jun 2005
Posts
5,361
Hi there,

There is a problem with my layout in IE and I need to have an if statement in there saying If the browser is IE, then set the margin to 0.

I know I can do this in the actual HTML.

But was wondering if it is possible to do this in the external CSS file.

I think i have seen this before, but I am not sure.

Thanks.

EDIT:

It is something like this, but i need it for all IE browsers:

Code:
/* Hides from IE-mac \*/
 
Last edited:
Cheers mate, but I don't think that works, because I think IE7 can pick up the technique used and I am sure there is something like what I put in the original post for all internet explorer browsers.
 
I already know how to do that, but I am trying to avoid it, I wanted to see if it was possible to keep all the css external.

Thanks anyways :)

EDIT:

This does exactly what I want, but I would prefer for it to be in the external css file, rather than linking to an external css file or being in the head of the html:

Code:
<!--[if IE]><style type="text/css" media="all">#nav{margin-left:-2px}</style><![endif]-->
 
Last edited:
The CSS would be external, it would be in a CSS file and then you use the conditional comments to link to the stylesheet.

Edit: Using the conditional comments to link to an extra CSS file is the best you're going to get, IMO.
 
Mr_L said:
The CSS would be external, it would be in a CSS file and then you use the conditional comments to link to the stylesheet.

Edit: Using the conditional comments to link to an extra CSS file is the best you're going to get, IMO.

That's one of the things that i am trying to avoid. But thanks for your help anyways.
 
Back
Top Bottom