How to make WordPress adminbar play well with fixed header

More often than not if you have a fixed header and logged-in as an admin, the adminbar is usually visible and overlapping the header.

Your visitors won’t see this but it’s annoying none the less.

The easy fix is add the css below:

/* Make the fixed header behave well with overlapping and adminbar */
body.admin-bar .site-header {
	top: 32px;
}
@media (max-width: 767.98px) {
	body.admin-bar .site-header {
		top: 0;
		position: sticky!important;
		background: #000!important;
	}
}

Leave a comment

Your email address will not be published. Required fields are marked *