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.
MLSLIAsked:
Who is Participating?
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
The normal way is to provide alternate stylesheets in the HTML using the IE conditional statements.
0
 
Dave BaldwinFixer of ProblemsCommented:
No, CSS doesn't understand the IE conditionals, they work just in the HTML.
0
 
MLSLIAuthor Commented:
DaveBaldwin:

Is there a way round this like:

<!important>

or any other inline hacks
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Bob StoneIT GuruCommented:
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

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

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.