css & html5: why does my body have a spacing at the top?

Late to the conversation, but thought this might help some...

If this a WordPress based site, it is likely that WordPress is adding:

 html { margin-top: 32px !important; }

It is doing this in order to make space for the admin bar, which, apparently, for some reason isn't showing up.

To resolve this, add the following to your theme's functions.php file:

add_filter('show_admin_bar', '__return_false');

You probably have an element with margin-top as one of the first children of body.

Read up on collapsing margins.

Purely as a simple test, set padding: 1px on body. If the gap goes away, I'm right.

Tags:

Html

Css