View Full Version : if else in css
registeredspider
02-09-2009, 07:27 AM
Hi..
I want to apply setting depending on browser version...
I'll show u a prototype
.mycssclass{
[if IE 6]
COLOR:RED;
[ELSE IF IE 7]
COLOR:blue;
[ELSE]
COLOR:GREEN;
[END IF]
}
For IEs, you can use conditional comments (http://www.quirksmode.org/css/condcom.html):
<style type="text/css">
.mycssclass {
color: green;
}
</style>
<!--[if IE 6]>
<style type="text/css">
.mycssclass {
color: red;
}
</style>
<![endif]-->
<!--[if IE 7]>
<style type="text/css">
.mycssclass {
color: blue;
}
</style>
<![endif]-->These are mostly applied to work around IE's many bugs. If you want to do other browsers too, firstly be very sure of what you're doing (if you're getting differing behaviour, it's probably because you haven't followed the standards (http://validator.w3.org/) properly) and then use JS, remembering to provide a non-JS fallback for non-JS users.
AlexAcosta
02-09-2009, 09:49 PM
I am pretty sure you cant use that format in css but try to create clean, standard compliant css files and it should work in IE and FF too.
If you need help try posting the problems here
try to create clean, standard compliant css files and it should work in IE and FF too.Considering that IE7 doesn't support half of CSS2, let alone the bits of CSS3 that other browsers are now starting to integrate, I doubt that very much.
registeredspider
02-10-2009, 06:19 AM
thank you.. for all ur support :D
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.