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 - 16 through 30 (of 34 total)
  • @rev. VooDoo

    Nope, I’m missing that code. I think you’re on to something, Watson…

    Yeah, if you don’t even have the code (and it’s a pretty big chunk) at the very bottom of your output, then something is blocking the menu from generating at all….

    Ok, on my site, it turns out that there was some code in the footer that was commented out. Since the wpadminbar is created by the wp_footer() function, usually called from footer.php in themes, if for any reason this function is commented out, the adminbar won’t display. I’ve un-de-commented this, and it works fine for me now.

    For anyone not seeing the bar: check footer.php if the wp_footer function isn’t there or simply commented out.

    I don’t recall why I would have commented that out, but there must have been a reason.

    Oh jeez, yeah…. you absolutely must have the wp_footer function

    Somwetimes I forget to ask the really obvious stuff


    Well I’ll be damned. I never put in wp_footer() into my theme. Works great now!

    Thanksssssssssssssssssss a funkload.

    Worked for me, too. Thanks!

    @kirkmc: Do I need to just check the footer.php within the theme or somewhere else?

    within the theme, you must have:

    <?php wp_footer(); ?>

    usually directly before the </body> tag in footer.php

    If that’s there, what else could I check to see why the Admin Bar is not showing? It’s not even showing within my dashboard. I have both options within my Profile checked too.

    I found my issue…

    I went through my plugins one by one. I needed to deactivate WPtouch Pro. Once that was deactivated, the Admin Bar showed within my Dashboard & on my site. I’ve reported the issue to BraveNewCode.

    @kirkmc Thanks to you and everyone in this thread! I was getting so frustrated trying to figure out where “html { margin-top: 28px !important; }” was coming from!

    Very useful thread and thanks for sharing your solution.

    Personally, I always thought that wp_footer() was not necessary if you had a custom footer, but that just goes to show that I know very little!

    Thanks for this post. Added wp_footer() and the bar showed up for me as well. Just stopping by to say thanks to all in this post for sorting it out.

    mmm, can we call this a bug? Will this be fixed in future updates?
    Don’t think I understand the footer part of this thread. I removed/commanded out the css code in the admin-bar.php to get rid of the margin in logged in mode.


    Sorry, it’s not a bug, you are required to call the function wp_footer() in your footer.php file, right before </body>.

    The WordPress documention does address this and it does verify this, just not well, explaining why when I built my custom theme I left out the required function.

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