3

デフォルトの Twenty Twelve Wordpressテーマのサブナビゲーション リンクをラッパー/コンテナ上に表示するにはどうすればよいですか?

ここに画像の説明を入力

header.php:

<nav id="site-navigation" class="main-navigation" role="navigation">
    <h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3>
        <a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a>
        <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</nav>

スタイル.css:

.site-content nav {
    clear: both;
    overflow: hidden;
}
.main-navigation .assistive-text:hover,
.main-navigation .assistive-text:active,
.main-navigation .assistive-text:focus {
    background: #fff;
    border: 2px solid #333;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    -o-border-radius: 3px;
    -ms-border-radius: 3px;
    border-radius: 3px;
    clip: auto !important;
    color: #000;
    display: block;
    font-size: 12px;
    padding: 12px;
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 100000; /* Above WP toolbar */
}

.main-navigation {
    text-align: center;
    clear: both;
}
.main-navigation li {
    font-size: 12px;
    font-size: 0.8571428571rem;
}
.main-navigation a {color: #5e5e5e;}
.main-navigation a:hover {color: #21759b;}
.main-navigation ul.nav-menu,
.main-navigation div.nav-menu > ul {display: none;}

.main-navigation ul.nav-menu.toggled-on,
.menu-toggle {display: inline-block;}
.menu-toggle {
    margin: 16px 0;
    margin: 1.1428571429rem 0;
}

.main-navigation ul.nav-menu.toggled-on li {margin-bottom: 16px;}

@media screen and (min-width: 600px) {
.main-navigation ul.nav-menu,
    .main-navigation div.nav-menu > ul {                    
        display: inline-block !important;
        text-align: center; 
        width: 100%;                    
    }

.main-navigation ul {text-indent: 0;}
.main-navigation li a,
.main-navigation li {
    display: inline-block;
    text-decoration: none;
    margin: 0 16px; 
    margin: 0 1.1428571429rem;  
}
.main-navigation li a {
    border-bottom: 0;
    color: #6a6a6a;
    padding: 12px 0;
    text-transform: uppercase;
    white-space: nowrap;
}
.main-navigation li a:hover {color: #89CBBF;}
.main-navigation li { 
    position: relative;
    margin: 0;
}

.main-navigation li:hover {background: #ededed;}

.main-navigation li ul {
    display: none;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 100%;
    z-index: 1;
}
.main-navigation li ul ul {
    top: 0;
    left: 100%;
}
.main-navigation ul li:hover > ul {
    border-left: 0;
    display: block;
}
.main-navigation li ul li a {
    background: #efefef;
    border-bottom: 1px solid #ededed;
    display: block;
    font-size: 11px;
    font-size: 0.7857142857rem;
    min-width: 180px;
    min-width: 12.857142857rem;
    white-space: normal;
    margin: 0;

    padding: 12px 5px;

    -moz-hyphens: auto; 
    -o-hyphens: auto; 
    -ms-word-break: break-all;
    -webkit-hyphens: auto;
    hyphens: auto;
    word-break: break-all;
    word-wrap: break-word;
}
.main-navigation li ul li a:hover {
    background: #e3e3e3;        
    color: #89CBBF;
}
.main-navigation .current-menu-item > a,
.main-navigation .current-menu-ancestor > a,
.main-navigation .current_page_item > a,
.main-navigation .current_page_ancestor > a {
    color: #89CBBF;
    font-weight: bold;
}

.menu-toggle {display: none;}
4

1 に答える 1

1

overflow: hidden from .site を削除してみる必要があると思います

于 2013-03-19T10:24:58.787 に答える