Make WordPress Core

Opened 6 years ago

Closed 2 years ago

#43244 closed enhancement (duplicate)

Admin toolbar breaking full height layouts

Reported by: loranrendel's profile loranrendel Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Toolbar Keywords: close
Focuses: Cc:

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 (4)

#1 @danieltj
6 years ago

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

#2 @ocean90
6 years 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
6 years 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.

#4 @sabernhardt
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

As mentioned in ticket:42300#comment:4, the discussion on #16222 concluded that margin was safer than padding 10 years ago. Any theme adjustments for the margin likely would not play well with a switch to padding.

I'll close this ticket as a duplicate of #42300. If padding is actually safer now, or there's another option, please add a comment there.

Note: See TracTickets for help on using tickets.