Why do HTML elements have different widths in MSIE than they do in Firefox?

Why do HTML elements have different widths in MSIE than they do in Firefox? The answer is that IE uses a different box model than Firefox. What is the box model?

I looked in Wikipedia for the answer, and this is what I learned:

The box model allows block-level elements - such as paragraphs and block-quotations - to be drawn with padding, borders, and margins.

As defined by those CSS specifications, when a width is explicitly specified for any block-level element it should determine only the width of the content within the box, then the padding, borders and margins added afterwards. Internet Explorer (prior to version 6) instead includes the padding and borders within the specified width, resulting in a narrower box when displayed.

[PPK favors the IE box model, and says,] “Web designers who create boxes for holding content care about the *visible* width of the box, about the distance from border to border. The borders, and not the content, are the visual cues for the user of the site. Nobody is interested in the width of the content.”

[Use of the ie box model] can make division of interior space (as one might do for colums in a layout) more difficult using the IE box model.

…if there are two boxes, one inside the other, and the inner box describes its width as 50%, it will be calculated based on the width of the outer box that is reported by the current box model. Since the inner box must exist within the border and padding of the outer box, using the IE box model, the inner box’s 50% width will take up more than 50% of the content space available to it.

Internet Explorer box model bug - Wikipedia, the free encyclopedia

Leave a Reply

You must be logged in to post a comment.