Solved

IE hacks in One Stylesheet

Posted on 2010-09-10
8
145 Views
Last Modified: 2013-09-01
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.
0
Comment
Question by:MLSLI
8 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 33648932
No, CSS doesn't understand the IE conditionals, they work just in the HTML.
0
 

Author Comment

by:MLSLI
ID: 33649080
DaveBaldwin:

Is there a way round this like:

<!important>

or any other inline hacks
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 63 total points
ID: 33649465
The normal way is to provide alternate stylesheets in the HTML using the IE conditional statements.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 17

Assisted Solution

by:nanharbison
nanharbison earned 62 total points
ID: 33649817
0
 
LVL 9

Expert Comment

by:Bob Stone
ID: 33653663
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
 

Expert Comment

by:jmoras
ID: 38920989
See the source code in a browser of www.toys-shop.gr we have implemented what you ask ..
0
 
LVL 58

Expert Comment

by:Gary
ID: 39456028
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now