* html /* this selector recognized by IE only */
{
width: ; /* total width (only for IE5.x/Win) */
w\idth: ; /* content width (for other IE) */
}
{
padding: ;
width: ; /* content width (for other browsers) */
}
The first rule is for IE. The nice part is that the second listing, using the escape hack (\), overrides IE 6, but not 5.5 and prior.
Keep in mind that the backslash cannot appear before the first letter of the property since IE5.x/Win understands that. Furthermore, the backslash cannot appear before the letters a to f, and A to F, and numerals 0 to 9 since doing so will turn those letters or numerals into hexadecimal numbers.The second rule (plain ole' selector) is recognized by all CSS-aware browsers. Because of specificity , the order of these rules doesn't matter. Specificity counts the number of ID attributes, other attributes and pseudo-class, and element names in the selector. So, if you have the same selectors, but one is declared a little more specific, that is the one that will apply. All in all, this is the most elegant system for hacking my CSS I've found yet.
Tagged As CSS
Comments are Open (1)
Posted at 09:15 AM
Comments
Xian
My favorite fix for IE5.x at this point is the mid-pass filter. It has the added bonus of keeping any and all ie5.x rules in a separate file.
http://tantek.com/CSS/Examples/midpass.html
It works by importing a ie5.x only stylesheet. This is great for me because I've taken to only linking one filter CSS file to my pages, and using that file to import the needed stylesheets. And the midpass CSS is just another one in the file.
Some advantages to the linked-filter stylesheet are that having the main CSS linked and not imported fends off the flash-of-unstyled content that some browsers show. Also other CSS files (for print or other media types) can be added easily while only changing one file - a bonus for static sites.
If this was worded awkwardly, I apologize.
Posted by: Xian | March 4, 2004 11:10 AM