html – in chrome or firefox,why has padding-bottom in this code? – Education Career Blog

i using doctype:

full code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
<div style="border:1px solid red;background-color:blue;"><img src=""></div>

you can check it out here

in chrome or firefox,why has a padding on bottom?

how to fix it?

(if I remove doctype, or in IE ,it’s be okey)

alt text


Set the image to display: block (preview), and it will no longer generate a line box. (Also, be aware that jsFiddle is annoying for doctype switching since it wraps your HTML.)

Read about the inline formatting model and almost standards mode.


EDIT: jleedev has the right answer. not deleting this because it is often the answer to this sort of issue

Different browsers have different “default” styles for elements. One popular technique is to use a “CSS Reset” stylesheet, that sets everything to neutral values for you, so that you can get consistent results across browsers.

Leave a Comment