WordPress header margin override

There used to be a margin in WordPress header.This is because of margin-top: 32px !important; style property.You can remove that by adding the below code in themes functions.php file .

<?php add_action( ‘wp_head’, ‘mp6_override_toolbar_margin’, 11 );
function mp6_override_toolbar_margin() { ?>
<style type=”text/css” media=”screen”>
html { margin-top: 0px !important; }
* html body { margin-top: 0px !important; }
</style>
<?php
}?>

2 thoughts on “WordPress header margin override”

  1. I think it happens when you are logged in to your wordpress account. That 32px space corresponds to the black menu line that is on the top of your page, which doesn’t appear but leaves the space for it . Log out and refresh the page and see if it continues or open the website in an other browser. Tha

Leave a Reply

Your email address will not be published.