I’ve wrestled with the box model variations between IE and Mozilla for years. And today I finally arrived at what seems to be the absolute easiest way to make things work.
The first line is valid and interpreted by both browsers. The second line is interpreted only by IE. Setting the width to the width you want (500px) minus (padding + margin + border) will give you the effect you want. You’ll have the same size box in both browsers. Yeehah!
I've got a masters degree in computer science and over 10 years of experience building web-based systems using Java/J2EE, Ruby, Rails and PHP. I'm a strong believer in the effectiveness of Agile Methods. Read more »
Box Model Hackery The Easy Way
I’ve wrestled with the box model variations between IE and Mozilla for years. And today I finally arrived at what seems to be the absolute easiest way to make things work.
The first line is valid and interpreted by both browsers. The second line is interpreted only by IE. Setting the width to the width you want (500px) minus (padding + margin + border) will give you the effect you want. You’ll have the same size box in both browsers. Yeehah!