Max width for images

img {
    max-width: 525px;
    /* Change 525 to the desired width value */
}

 

img {
    _width: expression(this.width < 525 ? 525: true);
    /* IE6 fix for max-width */
    /* Change both 525s to the desired width value */
}

 

Clear Floats

Floated elements often don't set the height of the parent control as they expand. I use this to fix all divs that contain floating content.

div:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}

/* Hides from IE-mac \*/
* html div {height: 1%;}
/* End hide from IE-mac */

 

Affect IE Only 

To adjust styles for internet explorer 7 on ly I use this method

*:first-child+html {

 

Correct List Item Heights

Add height: 1%; to your li class definition to colapse the height on Internet explorer 

 

Specify IE 'Has layout' 

_height:0; min-height:0; /* IE hasLayout fix */

 

IE5.5 & 6 Not Displaying Absolute Positioned Elements

If an element is proceeded by only floating elements within its container then the absolute positioned control needs to have:

clear: both; 

All the CSS hacks in one place

All the CSS hacks in one place

February 27, 2007
Olmec Sinclair
A collection of useful CSS work arounds to common issues faced while designing professional website in a multi browser world.