立体翻转导航

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
		<style>
			* {
				margin: 0;
				padding: 0;
			}

			ul {
				margin: 100px;
			}

			ul li {
				width: 120px;
				height: 35px;
				list-style: none;
				perspective: 800px;
			}

			.box {
				position: relative;
				width: 100%;
				height: 100%;
				transform-style: preserve-3d;
				transition: all 0.5s;
			}

			.box:hover {
				transform: rotateX(90deg);
			}

			.front,
			.back {
				position: absolute;
				left: 0;
				top: 0;
				width: 100%;
				height: 100%;
			}

			.front {
				background-color: pink;
				z-index: 1;
				transform: translateZ(17.5px);
			}
			.back {
				background-color: purple;
				transform: translateY(17.5px) rotateX(-90deg);
			}
		</style>
	</head>
	<body>
		<ul>
			<li>
				<div class="box">
					<div class="front"></div>
					<div class="back"></div>
				</div>
			</li>
		</ul>
	</body>
</html>
posted @ 2020-09-10 22:42  MarkJacobs  阅读(87)  评论(0)    收藏  举报