开发者

in chrome or firefox,why has padding-bottom in this code?

i using doctype:

http://www.w3.org/TR/html4/strict.dtd

full code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<BODY>
<div style="border:1px solid red;background-color:blue;"><img src="开发者_开发百科http://www.google.com/intl/en_ALL/images/srpr/logo1w.png"></div>
</BODY>
</HTML>

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)

in chrome or firefox,why has padding-bottom in this code?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜