css实现旋转菜单栏

html代码

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<link rel="stylesheet" type="text/css" href="css/demo.css"/>
		<title></title>
	</head>
	<body>
		<div class="container">
			<ul class="menu">
				<li><a href="">home</a></li>
				<li><a href="">first</a>
					<ul class="submenu">
						<li> <a href="">one</a></li>
						<li> <a href="">two</a></li>
						<li> <a href="">three</a></li>
						<li> <a href="">four</a></li>
						<li> <a href="">five</a></li>
					</ul>
				</li>
				<li><a href="">second</a></li>
				<li><a href="">third</a>
					<ul class="submenu">
						<li> <a href="">one</a></li>
						<li> <a href="">two</a></li>
						<li> <a href="">three</a></li>
						<li> <a href="">four</a></li>
						<li> <a href="">five</a></li>
					</ul>
				</li>
				<li><a href="">fourth</a></li>
				<li><a href="">other</a></li>
			</ul>
		</div>
		
		

	</body>
</html>

css代码

*{
	margin: 0;
	padding: 0;
	list-style: none;
	text-decoration: none;
}
.container{
	margin: 50px auto;
	width: 82%;
	
}
body{
	background: #ccc;
}


.container .menu{
	height: 40px;
	
}
.menu li{
	position: relative;
	min-width: 140px;
	background: linear-gradient(#666666,#999999);
}
.menu>li{
	float: left;
	text-align: center;
}
.menu>li:first-child{
	border-radius: 5px 0 0 0;
}
.menu a{
	display: block;
	color: #000;
	padding: 0 25px;
	font-size: 18px;
	line-height: 36px;
	border-left: 3px solid rgba(0,0,0,0);
	text-transform: uppercase;
}

.menu li:hover{
	background: linear-gradient(#111111,#424242);
}
.menu li:hover>a{
	color: #ffffff;
	border-left: 1px solid #fff;
}

.submenu{
	position: absolute;
	max-height:0;
	left: 0;
	top: 100%;
	z-index: 0;
	
	perspective: 400px;
	
}

.submenu li{
	opacity: 0;
	transform: rotate3d(0,1,0,90deg);
	transition: opacity 0.4s , transform 0.5s;
}
.menu>li:hover .submenu li{
	opacity: 1;
	transform: rotate3d(0,0,0,0deg);
}
.menu>li:hover .submenu{
	max-height: 1000px;
	z-index: 9;
}

.submenu li:nth-child(1){
	transition-delay: 0ms;
}
.submenu li:nth-child(2){
	transition-delay: 100ms;
}
.submenu li:nth-child(3){
	transition-delay: 200ms;
}
.submenu li:nth-child(4){
	transition-delay: 300ms;
}
.submenu li:nth-child(5){
	transition-delay: 400ms;
}
发布了5 篇原创文章 · 获赞 1 · 访问量 1408
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览