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 doctype declaration, it goes back to normal. I have completely reset padding, margins, etc. on everything, and cut it down to the a small amount of code that illustrates the issue.
The page can be seen at http://hackthetruth.org/webdesign/broken
Does anyone know why declaring the doctype is messing with the height of a div?
I had the same problem with one of my sites. i found this answer here:
"With an HTML5 doctype, images receive what seems to be the line-height attribute which text normally gets, and thus you get a “margin” underneath them. You can either set them to display:block or line-height:0, although I haven’t tested the latter enough to be sure it’s a good fix."
I applied the line-height:0
to the <div>
which contained the navigation images. It did the trick for me.