html 菜单//来源http://js.jirengu.com/hirasuxuva
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 菜单//来源http://js.jirengu.com/hirasuxuva相关的知识,希望对你有一定的参考价值。
.content {
width: 600px;
margin: 0 auto;
}
.navbar {
background-color: #f1f1f1;
list-style: none;
margin: 0;
padding: 0;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)!important;
}
.clearfix {
*zoom: 1;
}
.clearfix:after {
content: '';
display: block;
clear: both;
}
.navbar>li {
float: left;
position: relative;
}
.navbar li a {
display: block;
color: #000;
text-decoration: none;
padding: 8px 16px;
}
.navbar li a:hover {
color: #000;
background-color: #ccc;
}
.navbar li .sub-menu {
color: #000;
background-color: #fff;
display: none;
position: absolute;
top: 100%;
left: 0;
min-width: 160px;
margin: 0;
padding: 0;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}
.navbar>li:hover .sub-menu {
display: block;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.content {
width: 600px;
margin: 0 auto;
}
.navbar {
background-color: #f1f1f1;
list-style: none;
margin: 0;
padding: 0;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)!important;
}
.clearfix {
*zoom: 1;
}
.clearfix:after {
content: '';
display: block;
clear: both;
}
.navbar>li {
float: left;
position: relative;
}
.navbar li a {
display: block;
color: #000;
text-decoration: none;
padding: 8px 16px;
}
.navbar li a:hover {
color: #000;
background-color: #ccc;
}
.navbar li .sub-menu {
color: #000;
background-color: #fff;
display: none;
position: absolute;
top: 100%;
left: 0;
min-width: 160px;
margin: 0;
padding: 0;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}
.navbar>li:hover .sub-menu {
display: block;
}
</style>
</head>
<body>
<div class="content">
<ul class="navbar clearfix">
<li><a href="#">首页</a></li>
<li><a href="#">产品</a></li>
<li><a href="#">更多</a>
<div class="sub-menu">
<a href="#">关于我们</a>
<a href="#">加入我们</a>
</div>
</li>
</ul>
</div>
<script id="jsbin-source-css" type="text/css">.content {
width: 600px;
margin: 0 auto;
}
.navbar {
background-color: #f1f1f1;
list-style: none;
margin: 0;
padding: 0;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)!important;
}
.clearfix {
*zoom: 1;
}
.clearfix:after {
content: '';
display: block;
clear: both;
}
.navbar>li {
float: left;
position: relative;
}
.navbar li a {
display: block;
color: #000;
text-decoration: none;
padding: 8px 16px;
}
.navbar li a:hover {
color: #000;
background-color: #ccc;
}
.navbar li .sub-menu {
color: #000;
background-color: #fff;
display: none;
position: absolute;
top: 100%;
left: 0;
min-width: 160px;
margin: 0;
padding: 0;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}
.navbar>li:hover .sub-menu {
display: block;
}</script>
</body>
</html>
以上是关于html 菜单//来源http://js.jirengu.com/hirasuxuva的主要内容,如果未能解决你的问题,请参考以下文章
js动态添加select菜单 联动菜单
公众号自定义菜单添加特殊符号
公众号自定义菜单添加特殊符号
android 小例之两列菜单关联
android 左右滑动菜单
自定义导航栏切换(从下拉菜单到左侧滑动)