HTML5 vs HTML4 - h1 tag rendered with extra space - how to remove?

前端 未结 5 1291
别那么骄傲
别那么骄傲 2021-01-04 22:07

I took a page whose DTD was HTML4 Transitional and changed the doctype to and extra space appeared between the h1 and div beneath it. I

5条回答
  •  盖世英雄少女心
    2021-01-04 22:40

    Your bug deals with default line height.

    The HTML4 transitional is ignoring the contents of your H1 wrt line height, yielding a 25px tall element. The HTML5 is respecting the line-height of the H1 tag, which equates to 29px.

提交回复
热议问题