Link to home
Create AccountLog in
Avatar of MLSLI
MLSLIFlag for United States of America

asked on

IE hacks in One Stylesheet

Hello,

I was wondering if anyone knew if it possible to use IE hacks in one stylesheet.
We have tried but they don't work. The below example does not work.

. menu li {
background-color:red;
}
<!--[if IE 7]>
. menu li {
background-color:yellow;
}
<![endif]-->

I need to do something like this because we are building a Website Template builder that shares one page with a CSS stylesheet changing the entire look.
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

No, CSS doesn't understand the IE conditionals, they work just in the HTML.
Avatar of MLSLI

ASKER

DaveBaldwin:

Is there a way round this like:

<!important>

or any other inline hacks
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You can put java script into CSS files using expressions

Like this makes browsers that don't normally support max-width do so with a bit of script

See -
http://gadgetopia.com/post/2774
http://webfx.eae.net/dhtml/cssexpr/cssexpr.html

There are some that detest css expressions, but if it works best for a particular application, then so be it.
p
{
max-width:800px;
width:expression(document.body.clientWidth > 800? "800px": "auto" );
}

Open in new window

Avatar of jmoras
jmoras

See the source code in a browser of www.toys-shop.gr we have implemented what you ask ..
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.