padding + height problem on Firefox

Fabio Lee
FabioHub
Published in
1 min readFeb 25, 2008

I though I was facing an error on Firefox browser when using padding & height attributes together in a CSS class. But I was error, in the end, it is still IE browser problem.

Let take an example “height_without_doctype.html”
https://gist.github.com/fabiolee/b1ed562143124add459e26d337935b48.js
When we run this code, it will display different output on Firefox & IE.

Firefox height = padding-top + height = 50px + 50px = 100px

IE height = height = 50px

After I find Mr Google, it point me to this url which is perfectly solve my above problem.

The solution is simple, just add in a DOC type, then IE will follow a common standard same as Firefox.

So, the code changed to “height_with_doctype.html”

Both browsers work the same now.

--

--