CSS Problems

Have a look at the Holly hack.

Internet explorer counts padding as an addition to the width of an element, whereas Firefox doesn't adjust the width when padding is applied - the correct method according to the W3C. Therefore, if you have an element with a set width of 200px, and 20px padding, you would use the following code:

Code:
#element {
  width: 200px; /* All browsers can see this */
  padding: 20px;
}

* html #element {
  width: 160px; /* Only Internet Explorer recognises this */
}

av. :)
 
Last edited:
Al Vallario said:
Sorry, got to pick up on a couple of inaccuracies there :).

The Holly Hack traditionally involves passing an element height: 1%; in order that it obtains layout [hasLayout] to fix IE's issue with non-positioned or non-dimensioned boxes. * html #element is the "star-html hack", or such, that exploits a bug in IE's CSS parser to allow for IE-only rule sets. They're two different things. * html can be used in the Holly Hack, but it's not the actual 'hack' itself.

Additionally, the issues where "Internet explorer counts padding as an addition to the width of an element" applies only to IE5 and IE6 in quirks mode. The box model was fixed in IE6. The link in the OP will trigger standards-mode in IE6, and so shouldn't need any correction.
 
Back
Top Bottom