This page details an inline CSS hack for Internet Explorer 6 and 7 on Windows.
The best idea, however, would be to serve a separate stylesheet for each browser you’re hacking to.
Storing it here for my own posterity, these are inline CSS stylesheet hacks for Internet Explorer 6 and 7. Using these, you can add specific rules that are shown only to those two browser trainwrecks.
/* Show only to IE7 */
*:first-child+html [selector] {
background: red;
}
/* Show only to IE6 */
* html [selector] {
background: red;
}
Replace [selector] in the above two examples, to color that elements background red. Example selectors could be body, #my_id or .my_class.
There’s also a good list of inline hacks here.
it’s pretty rare that I need to hack inline CSS for IE. I generally use conditional comments to include a stylesheet
I took the liberty of wrapping your code in a pre container.
Yeah having a dedicated IE stylesheet is definately the cleanest and most forwards compatible way to go. However, sometimes you just want to take the shortcut and do the ugly hack. Those times, the above ones are good.
Noted.
I too use a dedicated IE stylesheet. Gotta love IE.
really drop ie6 support already. ie7 is good enough that i no longer have to do any hacks. Safari gives me more grief.
Thank you for posting this.