Last active
May 19, 2023 16:31
-
-
Save currentcreative/b2dc1800cb8d9f5342ea6a582238019b to your computer and use it in GitHub Desktop.
Remove weird spacing above Admin bar when testing mobile view in browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ADD THIS TO functions.php */ | |
// REMOVE MARGIN FROM WP ADMIN BAR during mobile testing | |
add_theme_support( 'admin-bar', array( 'callback' => 'my_admin_bar_css') ); | |
function my_admin_bar_css() | |
{ | |
?> | |
<style type="text/css"> | |
@media screen and (max-width: 600px) { | |
html body { margin-top: 0 !important; } | |
html { padding-top: 46px; } | |
} | |
@media screen and (min-width: 601px) { | |
html { margin-top: 32px; } | |
} | |
</style> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment