CSS

From Null-pointer

Jump to: navigation, search

Contents

body

body {
	font-family: verdana;
	font-size: 62.5%;
}

This font size for the base allows 10em to equal 10px.

CSS hacks

.box {
    background: #00f; /* all browsers including Mac IE */
    *background: #f00; /* IE 7 and below */
    _background: #f60; /* IE 6 and below */
    padding: 7px;
    color: #fff;
 }

Conditional comments

<p><!--[if IE]>
According to the conditional comment this is Internet Explorer<br />
<![endif]-->
<!--[if IE 5]>
According to the conditional comment this is Internet Explorer 5<br />
<![endif]-->
<!--[if IE 5.0]>
According to the conditional comment this is Internet Explorer 5.0<br />
<![endif]-->
<!--[if IE 5.5]>
According to the conditional comment this is Internet Explorer 5.5<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is Internet Explorer 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is Internet Explorer 7<br />
<![endif]-->
<!--[if gte IE 5]>
According to the conditional comment this is Internet Explorer 5 and up<br />
<![endif]-->
<!--[if lt IE 6]>
According to the conditional comment this is Internet Explorer lower than 6<br />
<![endif]-->
<!--[if lte IE 5.5]>
According to the conditional comment this is Internet Explorer lower or equal to 5.5<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is Internet Explorer greater than 6<br />
<![endif]-->
</p>

max-width

/* firefox */
max-width: 350px;
/* IE */
width: expression(Math.min(parseInt(this.offsetWidth), 350 ) + 'px'); 
/* usage */
<img src="img.jpg" style="max-width: 350px; width: expression(Math.min(parseInt(this.offsetWidth), 350 ) + 'px'); " />
Personal tools