Internet Explorer, Padding and Width
Filed in: Web Development — May 13th, 2005Kahsoon message me this morning, asked me about his blog layout width does not match in Firefox and Internet Explorer, the IE display the block width smaller than Firefox.
(Oh mah! Cross browser problem! *headache* )
From my past trial and error experience, I know IE is somehow does not like Padding. I didn’t know the reason, until I read the following article.
Microsoft decided that padding shouldn’t add to the total actual width of a block-level element, but should subtract from the content display space within the element. The text appears in a more confined space rather than a larger box. Their formula is margin-left, margin-right and width add together to compute actual width. Padding doesn’t play a roll.
Exposed: Visual Formatting Model Flaw In Internet Explorer v6.0
The author has a solution, use max-width. max-width is not recognized by Internet Explorer but yes for Mozilla. By using max-width, the content area will abit smaller(subtracted padding width) but same block width as in Internet Explorer.
Thought:
I haven’t test the max-width personally. It should work, right? Or, you have better solution to the problem(block width, Mozilla vs. IE, padding)?
I am beginner to CSS. Cross browser website layout always caused headache to me. The method I use is “trial and error”, and it always take long time for me to make a webpage look similiar in both Mozilla and IE.
You know, sometimes users are in so passive position.
Like this post? Please share:
Follow @liewcf on Twitter; Join Facebook page; Subscribe to free newsletter for updates like this article..




