how to delete margin-top: 32px !important from twe

2019-03-13 02:15发布

I want to remove the margin-top property from twenty twelve theme. This is the default theme provided by wordpress. The sample of the code what I found with the help of firebug.

html{
     margin-top: 32px !important;
    }

7条回答
Explosion°爆炸
2楼-- · 2019-03-13 02:41

Go to the functions file inside your theme folder:

functions.php

add_action('get_header', 'remove_admin_login_header');

function remove_admin_login_header() {
    remove_action('wp_head', '_admin_bar_bump_cb');
}
查看更多
The star\"
3楼-- · 2019-03-13 02:42

I had the same issue. I got rid of

wp_head();

in the header template and problem solved.

查看更多
一夜七次
4楼-- · 2019-03-13 02:43
function remove_admin_login_header() {
    remove_action('wp_head', '_admin_bar_bump_cb');
}
add_action('get_header', 'remove_admin_login_header');
查看更多
【Aperson】
5楼-- · 2019-03-13 02:53

in the style.css around line #1645 is body .site { which has padding top & bottom:

body .site {
    padding: 0 40px;
    padding: 0 2.857142857rem;
    margin-top: 48px;
    margin-top: 3.428571429rem;
    margin-bottom: 48px;
    margin-bottom: 3.428571429rem;
    box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
}
查看更多
放我归山
6楼-- · 2019-03-13 02:53

You can specify an identifier for the html tag in the template and set it to margin-top: 0! important;

#html {margin-top: 0 !important;}
查看更多
Luminary・发光体
7楼-- · 2019-03-13 02:55

Add the following function to your functions.php file

function my_function_admin_bar(){ return false; }
add_filter( 'show_admin_bar' , 'my_function_admin_bar');
查看更多
登录 后发表回答