Title: Admin bar CSS
Last modified: August 19, 2016

---

# Admin bar CSS

 *  Resolved [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/admin-bar-css/)
 * The Admin bar adds the following CSS to all front facing pages:
 *     ```
       body {
           padding-top: 28px !important;
       }
       ```
   
 * This can severely disrupt any absolutely positioned elements on the page. A better
   approach might be to use:
 *     ```
       body {
           position: relative !important;
           top: 28px !important;
       }
       ```
   
 * which (in theory) should preserve any existing positioning.

Viewing 15 replies - 1 through 15 (of 28 total)

1 [2](https://wordpress.org/support/topic/admin-bar-css/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/admin-bar-css/page/2/?output_format=md)

 *  Moderator [Dominik Schilling](https://wordpress.org/support/users/ocean90/)
 * (@ocean90)
 * WordPress Core Developer
 * [15 years, 3 months ago](https://wordpress.org/support/topic/admin-bar-css/#post-1834769)
 * If you have problems with it, you can define your own callback or remove it with
   `
   add_theme_support( 'admin-bar', array( 'callback' => '__return_false') );`
 *  Thread Starter [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/admin-bar-css/#post-1834777)
 * Thanks. I hadn’t realised that the admin bar was being added via add_theme_support.
   I’ll dig a little deeper into this. However, I still think that the default CSS
   needs looking at.
 *  [Andrew Nacin](https://wordpress.org/support/users/nacin/)
 * (@nacin)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835041)
 * The admin bar isn’t added by theme support — it’s considered supported by default.
   The code ocean90 posted is designed to allow you to offer your own callback for
   rendering the CSS for the admin bar, or in the case of `__return_false`, noop
   and have no new CSS.
 * We actually spent quite a while going over the CSS. Review our work at [http://core.trac.wordpress.org/ticket/15851](http://core.trac.wordpress.org/ticket/15851).
 *  [David Cameron Law](https://wordpress.org/support/users/seo-dave/)
 * (@seo-dave)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835054)
 * I’m rewriting a themes code (theme runs on thousands of sites) for a new release
   and have it working perfectly in WordPress 3.0.4 and below, wise to test on the
   beta release and hit a snag.
 * The padding was breaking my themes layout, wasn’t able to get it to work with
   WordPress 3.1 and earlier version of WordPress. One div was thrown off.
 * I tested Esmi’s code with my theme and it looks like it resolves the issue.
 * I have a div positioned with this CSS
 *     ```
       .navbar {
       width: 990px;
       position: absolute;
       top: 115px;
       }
       ```
   
 * this is not unusual theme code.
 * With the current WordPress 3.1 beta code it’s obviously not taking the 28px padding
   into account, so when the admin bar is present it’s 28px to high. With Esmi’s
   CSS code (as a replacement for the Admin bars CSS) it’s where it should be.
 * I didn’t want to force theme users to turn the admin menu off by default.
 * I’ve fixed the issue by adding a wrapper div to the whole theme and giving it
   position:relative; which means the absolute element that was being positioned
   absolute to the body is now positioned absolute to the wrapper div which is padded
   down in WordPress 3.1 and not in WordPress 3.0 and below. Really shouldn’t have
   to add this fix when a simple bit of CSS on the admin bar would have avoided 
   it for my theme and presumably lots like it.
 * David
 *  [Brian Krogsgard](https://wordpress.org/support/users/krogsgard/)
 * (@krogsgard)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835072)
 * Playing with the admin bar activated and not activated / logged in and not logged
   in, I noticed that when activated but not logged in it will take on padding other
   than 28px from the theme if defined.
 * For instance, if the theme padding is set to `body {padding-top: 80px;}` it will
   show up as 28px when the user is logged in and the admin bar is displayed, and
   80px when the user is not logged in and the admin bar is not displayed.
 * Would it be a good idea to make the forced padding to apply (to 0px rather than
   28px) even when the user is not logged in? That way theme authors will use margin
   to achieve what they want and not make the experience different for the user 
   depending on their login status.
 *  [Andrew Nacin](https://wordpress.org/support/users/nacin/)
 * (@nacin)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835073)
 * We’re changing what’s in core to another solution we really like.
 * [http://core.trac.wordpress.org/ticket/16222](http://core.trac.wordpress.org/ticket/16222)
 *  [paragate](https://wordpress.org/support/users/paragate/)
 * (@paragate)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835093)
 * How can we turn off the admin bar? It is covering my Buddypress menu. Thank you!
 *  [Stream The Game](https://wordpress.org/support/users/tgiwebsite/)
 * (@tgiwebsite)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835094)
 * > How can we turn off the admin bar? It is covering my Buddypress menu. Thank
   > you!
 * Same here?
 * Is there not an option to simply turn it off.
 *  [Stream The Game](https://wordpress.org/support/users/tgiwebsite/)
 * (@tgiwebsite)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835095)
 * [http://fourtencreative.com/2011/02/welcome-wordpress-3-1-now-turn-off-the-admin-bar/](http://fourtencreative.com/2011/02/welcome-wordpress-3-1-now-turn-off-the-admin-bar/)
 * Sorted!
 * Some Google time. 🙂
 *  [summerchilde](https://wordpress.org/support/users/summerchilde/)
 * (@summerchilde)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835096)
 * [@paragate](https://wordpress.org/support/users/paragate/)
 * open up your theme functions.php and add the following:
 * /* Disable the Admin Bar. */
    add_filter( ‘show_admin_bar’, ‘__return_false’ );
 * /* Remove the Admin Bar preference in user profile */
    remove_action( ‘personal_options’,‘
   _admin_bar_preferences’ );
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [15 years, 1 month ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835099)
 * Or just go to Users->Your Profile and click the checkboxes. No need for extreme
   code editing when the thing is optional to begin with.
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835100)
 * Buddypress is being updated as we speak to accomodate this
 *  [Mike Seifried](https://wordpress.org/support/users/mseifried/)
 * (@mseifried)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835101)
 * I’ve got one theme where the admin bar background appears but none of the menu
   items. I found one theme element (the nav bar) with a z-index of 99999. Thinking
   this conflicted with the z-index of the admin bar, I changed the z-index of the
   nav bar to 9999. That didn’t help. Any ideas?
 *  [mexicanNewbie](https://wordpress.org/support/users/mexicannewbie/)
 * (@mexicannewbie)
 * [15 years ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835107)
 * **HI !!**
    HOW CAN I ADD SOME CSS STYLE TO THE ADMIN BAR TO CUSTOMIZE IT ????
 * PLEASE HELP !!!!!
 * Ive just founded information about turn it off, but no to style it. Its suposed
   you can turn it off with
 * addfilter(‘show_admin_bar’, ‘__regurn_false’);
 * but… Aren’t filters a way to manipulate the html content??? How can I style or
   add some html to the ADMIN BAR???
 * THANKS FOR YOUR HELP AND ATTENTION !!!
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [15 years ago](https://wordpress.org/support/topic/admin-bar-css/#post-1835108)
 * Add HTML: [http://sumtips.com/2011/03/customize-wordpress-admin-bar.html](http://sumtips.com/2011/03/customize-wordpress-admin-bar.html)
 * Customize is just CSS. View the source of your page with the admin bar and add
   your changes to your theme’s CSS 🙂

Viewing 15 replies - 1 through 15 (of 28 total)

1 [2](https://wordpress.org/support/topic/admin-bar-css/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/admin-bar-css/page/2/?output_format=md)

The topic ‘Admin bar CSS’ is closed to new replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)

 * In: [Alpha/Beta/RC](https://wordpress.org/support/forum/alphabeta/)
 * 28 replies
 * 16 participants
 * Last reply from: [zignorp](https://wordpress.org/support/users/zignorp/)
 * Last activity: [14 years, 4 months ago](https://wordpress.org/support/topic/admin-bar-css/page/2/#post-1835158)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
