Skip to content

Commit ebe147c

Browse files
committed
Toolbar: Provide a CSS custom property for the admin bar height.
This new custom property, `--wp-admin--admin-bar--height`, reflects the admin bar's height and adjusts responsively on smaller screens. It can be used to offset content to avoid overlapping the admin bar, without needing to copy the media query. This also removes a workaround only needed for Internet Explorer 6 and below. Props nico23, sabernhardt. Fixes #52623. git-svn-id: https://develop.svn.wordpress.org/trunk@51672 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 80b24ab commit ebe147c

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/wp-includes/admin-bar.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,10 +1167,8 @@ function _admin_bar_bump_cb() {
11671167
?>
11681168
<style<?php echo $type_attr; ?> media="screen">
11691169
html { margin-top: 32px !important; }
1170-
* html body { margin-top: 32px !important; }
11711170
@media screen and ( max-width: 782px ) {
11721171
html { margin-top: 46px !important; }
1173-
* html body { margin-top: 46px !important; }
11741172
}
11751173
</style>
11761174
<?php

src/wp-includes/css/admin-bar.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
html {
2+
--wp-admin--admin-bar--height: 32px;
3+
}
4+
15
#wpadminbar * {
26
height: auto;
37
width: auto;
@@ -729,6 +733,10 @@ html:lang(he-il) .rtl #wpadminbar * {
729733
}
730734

731735
@media screen and (max-width: 782px) {
736+
html {
737+
--wp-admin--admin-bar--height: 46px;
738+
}
739+
732740
/* Toolbar Touchification*/
733741
html #wpadminbar {
734742
height: 46px;

0 commit comments

Comments
 (0)