milani_lucie
asked on
Conditional CSS
Hi,
I have the following code:
<html>
<head>
<style type="text/css">
body
{
[if IE] background-color : blue;
[if Gecko] background-color : red;
}
</style>
</head>
<body>
<form name="form1">
</form>
</body>
</html>
It is not working as expected in IE 6.0. Can you please FIX this ?
Thanks
I have the following code:
<html>
<head>
<style type="text/css">
body
{
[if IE] background-color : blue;
[if Gecko] background-color : red;
}
</style>
</head>
<body>
<form name="form1">
</form>
</body>
</html>
It is not working as expected in IE 6.0. Can you please FIX this ?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@LAMASE's examples are correct. The conditional statements are in the HTML file and can control loading of additional CSS files but the conditional statements do Not work inside the CSS declarations or files. In addition, only IE will recognize them. Using [if Gecko] has no effect, Mozilla and Webkit browsers do not recognize such things.
http://www.conditional-css.com/usage
try this, calling different styles in head section
Open in new window
Keep in mind that you can make everything in a common css file, then include different "patch" css files for different browsers.