How To Remove Space Above Header In WordPress

Mosquito2

If you are working on a WordPress theme and notice an annoying white space that appears at the top of your pages, it is most likely due to the admin menu.  If you inspect the page using the Developer Console in your browser by pressing F12, when you highlight the html tag you will see the following css is being applied:

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

To “neutralize” this extra space, add the following code to your style.css file.  You may need to adjust it slightly depending on your theme but this should remove the annoying extra space at the top of your pages.

/* Remove whitespace from top */
html {
    margin-top: -22px !important;
}