Monday, February 25, 2008

padding + height problem on Firefox

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"

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.

No comments:

Post a Comment