How to apply width to IE and not Firefox


Well the solution is simple. All you need is the knowledge of some keyword that IE recognises while setting the property value, while Mozilla ignores it.

Few solutions:

1. Using Expressions:
div#maincontainer{
width:300px;
/* IE and mozilla will take the width as 300px */
width:expression(‘100%’);
/* But now mozilla will ignore this statement, but IE will take it
End result: In IE the div gets rendered with a width of 100%, but
in Mozilla it get rendered with a width of 300px */
}

2. Using separate stylesheet for IE and Mozilla
Add the following in the head tag of your page, wherein you add the reference to stylesheet.
< !–[if IE]>
< type=”text/css”>
< @import url(‘iespecific.css’);
< /style>
< ![endif]–>

3. Using Incremental Overrides
div{ } /* Works for all */
* html div { } /* Works for IE */

There can be a lot of other hacks out there. Do explore your options. Hope this gives you a headstart.

Feel free to leave a reply here...