Solution to the blank 28px height on the top of the Wordpress website Browser

Source: Internet
Author: User

When using wordpress to build a website and write themes, occasionally there will be a 28 PX height gap between the top of the website and the browser, even if the Declaration * {margin: 0;} In CSS remains unchanged! Using Chrome to review elements occurs in the entire html, rather than an element in html.

This problem is because wordpress's wp_head () function adds a style by default!

<Style type = "text/css" media = "print" ># wpadminbar {display: none ;}</style>

<Style type = "text/css">

Html {margin-top: 28px! Important ;}

* Html body {margin-top: 28px! Important ;}

</Style>

We can delete this style, and then we will wonder why wordpress will add this style? It turns out that wordpress is used to display the position left by the toolbar on the top of the website after the Administrator logs on. This is often the case when the website Administrator logs on to the wordpress background and then opens the website front-end page. It's easy to think about it. We just need to retrieve the toolbar that should have been displayed ~ The solution is to add the </body> label <? Php wp_footer ();? > The function is ready ~

Link to this article: http://www.uqishi.com/wordpress_top_28px_spacing.html reprint please indicate the source.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.