Support » Fixing WordPress » margin-top added to html and body tags after upgrade to 3.1!?!

  • Resolved fgshepard


    We upgraded to 3.1 this morning and now find the following style rule dynamically added to our header:
    <style type=”text/css”>
    html { margin-top: 28px !important; }
    * html body { margin-top: 28px !important; }

    This is not in our “header.php” file and so I assume it’s being added by wordpress (i.e., there is no evidence that we’ve been hacked). I’m guessing it has something to do with the new admin bar but not sure. Any ideas what’s going on or how to turn it off?

    Here’s a URL:

Viewing 15 replies - 1 through 15 (of 34 total)
  • It probably has to do with the new admin bar in top of the screen.

    /* Disable the Admin Bar. */
    remove_action( 'init', 'wp_admin_bar_init' );

    your assumption is correct, that is for the admin bar. add this code to functions.php to disable the admin bar if you wish/if necessary

    note that the bar is only visible when you are logged in

    Thanks for the info. I guess this would have been obvious if the admin bar actually appeared on the site. I am logged in but only see the extra margin — no admin bar. Is there a setting I need to adjust to make this work?



    It should show…. is your page fully loaded? My admin bar sometimes seems to hang…. I have to scroll the page up and down to get it to pop into place

    You can check in your user profile I believe to see if you are set up to display the bar

    I’m having this exact same problem as fgshepard. I was about to make a new post about it. My admin bar works if I turn it on to display in the admin area, so it’s functional, but on the actual website area, it’s all white. Firebug reports it as a margin, just as fgshepard descibes.

    I also built the theme I’m using myself, so I’m sure it’s a problem with theme compatibility.

    What do?

    Basic testing first, its always the same

    switch to twentyten and see if it works

    then test with all plugins disabled….

    That way you know where the problem lies

    For me, I did an absolute clean install. I wiped the DB and deleted everything except my theme files then downloaded the latest release from the site (3.1). And yes, it works in twentyten. I have no plugins installed.

    In my case, I see the extra margin display as white space, then the rest of the page jumps up into its normal (pre-admin bar) position. So it has to be something in my theme that’s preventing its display.

    Yes, I also see it as white space. The entire page is pushed down 75ish pixels or so.

    Removing the admin bar from displaying by unchecking it removes the white space, so it’s definitely the placeholder for the admin bar.

    Are you able to use firebug to inspect any other possible css conflicts/issues?

    I’ve gone into the Webkit element inspector and turned off all of my scripts and stylesheets and still cannot get the admin bar to display. Not sure if this is an effective way to test something like this, however.

    Not that I can find.

    HTML checks out as nearly valid (using center tag in one place and & isn’t escaped to &ampĀ )

    CSS checks out 100% with CSS 2.1 and 3.0.

    Same here…it goes away when I check “in dashboard” or deselect both options for the “Show menu bar” option.

    I changed my theme to Twenty Ten and the menu bar does show.

    When I switch to the one I made, it does not work. Would love to know how I can have the menu bar show up in the themes I create…

    Are there any upgrade-specific template changes that might be necessary to make this work? Similar to those necessary to make widgets appear awhile back?

    Do you see the html output for the admin menu? When you view source from in the browser, its waaay at the bottom


    <div id="wpadminbar">
    			<div class="quicklinks"

    If so, then the output is good.

    After that, it may be css or js conflicts perhaps

    For css focus on anything relevant to your body tag

Viewing 15 replies - 1 through 15 (of 34 total)
  • The topic ‘margin-top added to html and body tags after upgrade to 3.1!?!’ is closed to new replies.