Why does the HTML5 DOCTYPE mess with my padding?

前端 未结 8 1478
灰色年华
灰色年华 2021-01-31 16:25

I have an html5 page with a navbar. Completely scratch coded. I just recently added a doctype to the item, and now I’m getting extra space under my navbar. If I remove the docty

8条回答
  •  情书的邮戳
    2021-01-31 16:56

    I had the same problem when upgrading a XHTML4 website to HTML5. I had lots of these:

    
    

    Which ended up with the magical extra padding around the images. For me the solution was simple -- add this css:

    img { vertical-align: top; }
    

提交回复
热议问题