WordPress.org

Make WordPress Core

Opened 21 months ago

Last modified 21 months ago

#43244 new enhancement

Admin toolbar breaking full height layouts

Reported by: loranrendel Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Toolbar Keywords: close
Focuses: Cc:
PR Number:

Description

The Adminbar breaks full-height layouts by using margin on html, but if we will replace _admin_bar_bump_cb code with following:

    <style type="text/css" media="screen">
        html { padding-top: 32px !important; }
        @media screen and ( max-width: 782px ) {
            html { padding-top: 46px !important; }
        }
    </style>

that will work like before, but stops breaking full-height layouts, for example

html{height: 100%}
body{min-height: 100%}

Change History (3)

#1 @danieltj
21 months ago

  • Component changed from General to Toolbar
  • Summary changed from adminbar to Admin toolbar breaking full height layouts

#2 @ocean90
21 months ago

  • Keywords close added

Related: #30055, #42300

You can override the default toolbar styling if you theme doesn't work with it properly. To disable the default styling you can use:

<?php
add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) );

#3 @loranrendel
21 months ago

I already do following:

add_action('get_header', 'fix_adminbar');

function fix_adminbar()
{
    remove_action('wp_head', '_admin_bar_bump_cb');
    add_action('wp_head', 'admin_bar_bump_cb');
}

function admin_bar_bump_cb()
{
    echo '<style type="text/css" media="screen">
        html { padding-top: 32px !important; }
        @media screen and ( max-width: 782px ) {
            html { padding-top: 46px !important; }
        }
    </style>';
}

on all my sites.

Note: See TracTickets for help on using tickets.