CSS Hacks

Hide From Win IE

Child Selector Command

html>body #header {margin-bottom:1em}

Hide From Win IE6

Hide From Win IE5/5.5

Box Model Hack

#header {
  padding: 2em; 
  border: 0.5em; 
  width: 15em; 
  voice-family: "\"}\""; /* IE5 cannot see from here */
  voice-family:inherit; width: 10em
}

Hide From Mac IE5

Commented Backslash Hack

/* commented backslash hack v2 \*/
#isnotMacIE5 { display: block; background-color: #060; color: #fff; }
#isMacIE5 { display: none; }
/* end hack */

Hide From Netscape 4

Import CSS (not supported by NS4)

<style type="text/css">@import url(cssfile.css);</style>

Caio Hack

/*/*/.emptyrule{}
div {width:553px;}
/* */

Hide From Firefox

Hide From all browsers except IE5.x

The Simplified Box model Hack (SBMH)

div {
width: 100px; /* Seen by OP5 */
}
div {
\width: 140px; /* Seen by IE5.x only */
w\idth: 100px; /* Seen by NS6, IE6, OP6, Mozilla */
}

Note: If Nav4 sees even one escape anywhere in the CSS, it will discard the entire sheet. So it is vital that this hack be hidden from that browser, by means of @import,

Hide From all browsers except IE (IE7 not include)

Star HTML Hack

/* the following rules apply only to IE6 and below */
* html{
}
 
* html body{
}
 
* html .foo{
 
}

Hide from all browsers except IE7

Star HTML Hack

/* the following rules apply only to IE7 */
*+html .foo{
}
 
webdev/css-hacks.txt · Last modified: 2008/10/29 14:26 by admin