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

前端 未结 12 1017
情深已故
情深已故 2021-01-31 20:52

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.

相关标签:
12条回答
  • 2021-01-31 21:06

    Remove margin from h1 - h6 elements. WP have default margins and that is why you see 32px !Important in inline HTML code.

    0 讨论(0)
  • 2021-01-31 21:07

    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);
    }
    
    0 讨论(0)
  • 2021-01-31 21:11

    I had the same issue. I got rid of

    wp_head();
    

    in the header template and problem solved.

    0 讨论(0)
  • 2021-01-31 21:12
    function remove_admin_login_header() {
        remove_action('wp_head', '_admin_bar_bump_cb');
    }
    add_action('get_header', 'remove_admin_login_header');
    
    0 讨论(0)
  • 2021-01-31 21:12

    You can use a filter like this:

    add_filter('show_admin_bar', '__return_false');
    
    0 讨论(0)
  • 2021-01-31 21:14

    A better way to do this is to add theme support for the admin bar with a callback of "return false", then Wordpress wont ever trigger the _admin_bar_bump_cb action which is responsible for adding in the margin-top:32px.

    add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) );
    
    0 讨论(0)
提交回复
热议问题