Home › Forums › CSS › Putting IE-specific CSS on the main stylesheet using HTML conditional comments
- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
January 3, 2012 at 8:08 pm #35955
mmcgu1966
ParticipantInstead of having HTML conditional comments load IE-specific stylesheets, you can use conditional comments to put content into the HTML, including different
statements. In this case, I’m using three classes: .ie, .old_ie, and .ie_nine. If it’s not IE, it uses a standard element with no class. Take a look at this block of code:
In the stylesheet, I have an INTERNET EXPLORER section down at the bottom and any IE specific code can refer to the .ie, .ie_nine, or .old_ie classes. For example, if my footer has a transparent background color, IE9 can handle it, but older IE can’t, so I would refer to .old_ie footer { } in the IE part of the stylesheet.
Besides wanting to share… anybody know if this sort of trick is a bad idea?