Solved

IE hacks in One Stylesheet

Posted on 2010-09-10
8
146 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 83

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 83

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do i set padding within the sidebar? 2 26
form button worked now it doesnt anymore 9 36
Error on link 14 36
Change CSS to show Notification Bar 9 11
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

932 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

14 Experts available now in Live!

Get 1:1 Help Now