gpt4 book ai didi

php - CSS 编辑两个导航栏(Adelle 主题)

转载 作者:太空宇宙 更新时间:2023-11-03 17:46:49 25 4
gpt4 key购买 nike

我添加了第二个导航菜单 (nav2),但它采用了第一个 (nav1) 菜单的外观,我无法修复它。另一方面,它的内容是不同的。

一段header.php:

 <nav class="nav" role="navigation">
<?php wp_nav_menu( array( 'theme_location' => 'extra_menu&container_class=menu&fallback_cb=false&show_home=1' ) ); ?>
</nav><!-- .nav -->

<nav2 class="nav" role="navigation">
<?php wp_nav_menu( array( 'theme_location' => 'top_menu', 'menu' => 'nav2')); ?>
<form role="search" method="get" class="header-form" action="<?php echo esc_url( home_url() ); ?>">
<fieldset>
<input type="text" name="s" class="header-text uniform" size="15" title="<?php esc_attr_e( 'Search','adelle-theme' ); ?>" />
<input type="submit" class="uniform" value="<?php esc_attr_e( 'Search','adelle-theme' ); ?>" />
</fieldset>
</form>
</nav2><!-- .nav2 -->

CSS:

      /* .nav */
.mobile-nav {display: none;}
.tinynav {display: none;}
.nav {position: relative; top: 0px; width: 970px; display: inline-block; background: #000; padding: 0 25px; margin-top: 0px; clear: both; line-height: 1em; text-transform: uppercase;}

.nav:before,
.nav:after {border: 1.6em solid #000; content: ""; display: block; position: absolute; bottom: 0; top: 0; z-index: 1;}
.nav:before {border-left-color: #fff; border-right-width: 1.4em; left: 0;}
.nav:after {border-left-width: 1.4em; border-right-color:#fff; right: 0;}

.nav ul {list-style: none; max-width: 780px; display: inline-block;}
.nav a {display: block; padding: 14px; color: #fff;}
.nav a:hover {text-decoration: underline; color: #fff;}
.nav ul ul a {display: block; padding: 14px; position: relative;}


/* .nav2 */
.mobile-nav {display: none;}
.tinynav {display: none;}
.nav2 {position: fixed; top: 10px; width: 2000px; display: inline-block; background: #fff; padding: 0 25px; margin-top: 40px; clear: both; line-height: 1em; text-transform: uppercase;}

.nav2:before,
.nav2:after {border: 1.6em solid #000; content: ""; display: block; position: absolute; bottom: 0; top: 0; z-index: 1;}
.nav2:before {border-left-color: #fff; border-right-width: 1.4em; left: 0;}
.nav2:after {border-left-width: 1.4em; border-right-color:#fff; right: 0;}

.nav2 ul {list-style: none; max-width: 780px; display: inline-block;}
.nav2 a {display: block; padding: 14px; color: #fff;}
.nav2 a:hover {text-decoration: underline; color: #fff;}
.nav2 ul ul a {display: block; padding: 14px; position: relative;}

最佳答案

如果你想要 2 个导航,一个看起来与另一个不同,我建议你对两者都使用 nav 标签,但为第二个导航添加一个唯一的 ID,并在你的 css 中使用该 ID 来覆盖你需要的样式更改第二个导航:

<nav>stuff here</nav>
<nav id="secondary-nav">stuff here</nav>

您不一定需要主导航上的类。您可以这样设置样式:

nav {
position: relative;
top: 0px;
width: 970px;
}

nav#secondary-nav {
top: 10px;
width: 2000px;
}

关于php - CSS 编辑两个导航栏(Adelle 主题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28001046/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com