17 June, 2009

Useful IE CSS hacks

Many of the developers feel pain to develop their applications in cross platform, especially when there is Internet Explorer 6. This is because, IE6 do not support some core css Styles like min-height. Also, Many times it is observed that IE renders the things a bit different compared to other browsers. The following are the useful hacks for developing websites in IE.

Min-Height Property in IE6:
This is a very commonly used property to set the look and feel of the page. There is a workaround for this tag in IE6. Use the following styles in sequence:
min-height: 600px;
height:auto !important;
height:600px;
These lines can solve the problem of fixing min-height for ie6.

IE6 specific functionality:
Many times, IE6 require different styles from other browsers for constant look across the browsers. Then we have to define those properties two times, once for all the browsers and second for IE6. Many of the developers define a special css file for IE6 and will add that on checking the client browser. Another workaround for this is to add IE6 specific hack for all the properties.

IE6 hack is to prefixing an underscore(_) before the property. For Example,
If we need the height of an object to 450px and in IE6 it is 430px then write these styles as

height: 450px;
_height:450px;

Only IE6 can understood these properties and render the page. These hacks are handy while developing the web pages in a cross browser platform.

Happy Programming.!!

No comments:

Post a Comment