css实现自适应下拉菜单栏导航效果代码

代码语言:html

所属分类:菜单导航

代码描述:css实现自适应下拉菜单栏导航效果代码

代码标签: css 自适应 下拉 菜单 导航

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />
        <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/reset.min.css">
<style>
body {
	background:#ccc;
	font-family:helvetica,arial,serif;
	font-size:13px;
	text-transform:uppercase;
	text-align:center
}
.wrap {
	display:inline-block;
	-webkit-box-shadow:0 0 70px #fff;
	-moz-box-shadow:0 0 70px #fff;
	box-shadow:0 0 70px #fff;
	margin-top:40px
}
.decor {
	background:#6EAF8D;
	background:-webkit-linear-gradient(left,#CDEBDB 50%,#6EAF8D 50%);
	background:-moz-linear-gradient(left,#CDEBDB 50%,#6EAF8D 50%);
	background:-o-linear-gradient(left,#CDEBDB 50%,#6EAF8D 50%);
	background:linear-gradient(left,white 50%,#6EAF8D 50%);
	background-size:50px 25%;
	padding:2px;
	display:block
}
a {
	text-decoration:none;
	color:#fff;
	display:block
}
ul {
	list-style:none;
	position:relative;
	text-align:left
}
li {
	float:left
}
ul:after {
	clear:both
}
ul:before,ul:after {
	content:" ";
	display:table
}
nav {
	position:relative;
	background:#2B2B2B;
	background-image:-webkit-linear-gradient(bottom,#2B2B2B 7%,#333 100%);
	background-image:-moz-linear-gradient(bottom,#2B2B2B 7%,#333 100%);
	background-image:-o-linear-gradient(bottom,#2B2B2B 7%,#333 100%);
	background-image:linear-gradient(bottom,#2B2B2B 7%,#333 100%);
	text-align:center;
	letter-spacing:1px;
	text-shadow:1px 1px 1px #0E0E0E;
	-webkit-box-shadow:2px 2px 3px #888;
	-moz-box-shadow:2px 2px 3px #888;
	box-shadow:2px 2px 3px #888;
	border-bottom-right-radius:8px;
	border-bottom-left-radius:8px
}
ul.primary li a {
	display:block;
	padding:20px 30px;
	border-right:1px solid #3D3D3D
}
ul.primary li:last-child a {
	border-right:0
}
ul.primary li a:hover {
	color:#000
}
ul.sub {
	position:absolute;
	z-index:200;
	box-shadow:2px 2px 0 #BEBEBE;
	width:35%;
	display:none
}
ul.sub li {
	float:none;
	margin:0
}
ul.sub li a {
	border-bottom:1px dotted #ccc;
	border-right:0;
	color:#000;
	padding:15px 30px
}
ul.sub li:last-child a {
	border-bottom:0
}
ul.sub li a:hover {
	color:#000;
	background:#eee
}
ul.primary li:hover ul {
	display:block;
	background:#fff
}
ul.primary li:hover a {
	background:#fff;
	color:#666;
	text-shadow:none
}
ul.primary li:hover>a {
	color:#000
}
@media only screen and (max-width:600px) {
	.decor {
	padding:3px
}
.wrap {
	width:100%;
	margin-top:0
}
li {
	float:none
}
ul.primary li:hover a {
	background:0;
	color:#8B8B8B;
	text-shadow:1px 1px #000
}
ul.primary li:hover ul {
	display:block;
	background:#272727;
	color:#fff
}
ul.sub {
	display:block;
	position:static;
	box-shadow:none;
	width:100%
}
ul.sub li a {
	background:#.........完整代码请登录后点击上方下载按钮下载查看

网友评论0