【CSS】transform-style: preserve-3d —— 旋转的轮播图

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>旋转轮播图</title>
	<style type="text/css">
		body {
			perspective:2500px; /*视角*/
		}
		section {
			width: 450px;
			height: 300px;
			background: url(../img/cqz-6.jpg) no-repeat;
			background-size: cover;
			margin: 100px auto;
			position: relative;
			transform-style: preserve-3d;  /*让子元素盒子以3d形式显示*/
			transition: all 5s linear;  /*匀速旋转*/
		}
		section:hover {
			transform: rotateY(360deg);
		}
		div {
			width: 100%;
			height: 100%;
			background-repeat: no-repeat;
			background-size: cover;
			position: absolute;
			top: 0;
			left: 0;
		}
		div:nth-child(1) {
			background: url(../img/cqz-1.jpg);
			transform: rotateY(0deg) translateZ(500px);
		}
		div:nth-child(2) {
			background: url(../img/cqz-2.jpg);
			transform: rotateY(72deg) translateZ(500px);
		}
		div:nth-child(3) {
			background: url(../img/cqz-3.jpg);
			transform: rotateY(144deg) translateZ(500px);
		}
		div:nth-child(4) {
			background: url(../img/cqz-4.jpg);
			transform: rotateY(216deg) translateZ(500px);
		}
		div:nth-child(5) {
			background: url(../img/cqz-5.jpg);
			transform: rotateY(288deg) translateZ(500px);
		}
	</style>
</head>
<body>
	<section>
		<div></div>
		<div></div>
		<div></div>
		<div></div>
		<div></div>
	</section>
</body>
</html>

效果如下:
【CSS】transform-style: preserve-3d —— 旋转的轮播图

上一篇:Mysql 事件(定时任务)


下一篇:python爬虫之模拟登陆(一)