如何使用WordPress将动态下拉菜单进行开发WP_NAV_MENU
HTML:
<div class="containers">
<div class="logo">
<img src="<?php echo get_theme_mod('webdeveloperjoy_logo') ?> " width="100px">
</div>
<ul id="nav">
<li><a href="#">home</a></li>
<li><a href="#">about</a></li>
<li>
<a href="#">service</a>
<div class="sub">
<ul>
<li><a href="#">Web design</a></li>
<li><a href="#">Web development</a></li>
<li><a href="#">Seo</a></li>
</ul>
</div>
</li>
<li>
<a href="#">Gallery</a>
<div class="sub">
<ul>
<li><a href="#">one</a></li>
<li><a href="#">two</a></li>
<li><a href="#">three</a></li>
<li><a href="#">four</a></li>
</ul>
</div>
</li>
<li>
<a href="#">login</a>
<div class="sub">
<ul>
<li><a href="#">sign up</a></li>
<li><a href="#">five</a></li>
<li><a href="#">six</a></li>
</ul>
</div>
</li>
</ul>
</div>
CSS:
/*===================================
css strat:
====================================*/
*{
padding: 0;
margin: 0;
box-sizing:
border-box;
font-family: 'Ms Madi', cursive;
}
.containers {
width: 100%;
height: 50px;
background: red;
display: flex;
align-items: center
justify-content: space-around;
position: relative;
}
#nav {
display: flex;
list-style: none;
align-items: center;
margin-top: 15px;
}
#nav li a {
padding: 0 10px;
text-decoration: none;
text-transform: uppercase;
color: white
font-family: 'Oswald', sans-serif;
}
#nav li a:hover {
background: blue;
color: white;
padding: 10px;
}
.sub {
display: none;
}
ul li:hover .sub {
display: block;
}
.sub ul {
position: absolute;
display: block;
margin-top: 5px;
background: red;
padding: 10px;
}
.sub ul li {
list-style: none;
padding: 10px;
}
.sub ul li a {
color: white;
}
HTML:
<div class="containers">
<div class="logo">
<img src="<?php echo get_theme_mod('webdeveloperjoy_logo') ?> " width="100px">
</div>
<ul id="nav">
<li><a href="#">home</a></li>
<li><a href="#">about</a></li>
<li>
<a href="#">service</a>
<div class="sub">
<ul>
<li><a href="#">Web design</a></li>
<li><a href="#">Web development</a></li>
<li><a href="#">Seo</a></li>
</ul>
</div>
</li>
<li>
<a href="#">Gallery</a>
<div class="sub">
<ul>
<li><a href="#">one</a></li>
<li><a href="#">two</a></li>
<li><a href="#">three</a></li>
<li><a href="#">four</a></li>
</ul>
</div>
</li>
<li>
<a href="#">login</a>
<div class="sub">
<ul>
<li><a href="#">sign up</a></li>
<li><a href="#">five</a></li>
<li><a href="#">six</a></li>
</ul>
</div>
</li>
</ul>
</div>
CSS:
/*===================================
css strat:
====================================*/
*{
padding: 0;
margin: 0;
box-sizing:
border-box;
font-family: 'Ms Madi', cursive;
}
.containers {
width: 100%;
height: 50px;
background: red;
display: flex;
align-items: center
justify-content: space-around;
position: relative;
}
#nav {
display: flex;
list-style: none;
align-items: center;
margin-top: 15px;
}
#nav li a {
padding: 0 10px;
text-decoration: none;
text-transform: uppercase;
color: white
font-family: 'Oswald', sans-serif;
}
#nav li a:hover {
background: blue;
color: white;
padding: 10px;
}
.sub {
display: none;
}
ul li:hover .sub {
display: block;
}
.sub ul {
position: absolute;
display: block;
margin-top: 5px;
background: red;
padding: 10px;
}
.sub ul li {
list-style: none;
padding: 10px;
}
.sub ul li a {
color: white;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 WP Bootstrap navwalker WordPress的动态下拉菜单。
https://github.com/wp-bootstrap/wp-bootstrap/wp-bootstrap-bootstrap-navwalker
Use WP Bootstrap Navwalker dynamic drop-down menu for WordPress.
https://github.com/wp-bootstrap/wp-bootstrap-navwalker