html doctype adds whitespace?

前端 未结 4 1816
慢半拍i
慢半拍i 2020-12-09 13:03

can someone please explain to me why having a doctype of

and

4条回答
  •  [愿得一人]
    2020-12-09 13:19

    As you can see in this table, the first Doctype triggers quirks mode in all browsers, the second will trigger standards mode.

    The rest of this story is continued at Images, Tables, and Mysterious Gaps:

    Setting images to be blocks

    The first choice, and one that will work for most graphically-intense designs, is to convert the image from being an inline element to a block-level element. Do that, and it no longer generates a line box, and so the problem goes away-- assuming that the image is the only thing that occupies that table cell. In the simplest case, we might add a style like this:

    td img {display: block;}
    

提交回复
热议问题