CSS3翻盖特效

在这里插入图片描述

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8"> <!-- meta元数据 告诉浏览器  网页的一些基本信息 -->
		<title>滑盖特效</title>
		<style type="text/css">
			* {
				margin: 0;
				padding: 0;
			}

			.main {
				position: relative;
				margin: 100px auto;
				width: 660px;
				height: 660px;
				/* background-color: white; */
			}

			.box {
				float: left;
				position: relative;	/* 绝对定位:脱离文档流,以带有position属性的父元素*/
				width: 220px;
				height: 220px;
				background-color: crimson;
				border-radius: 110px;
			}

			img {
				position: absolute;
				width: 100%;
				height: 100%;
				border-radius: 110px;
				z-index: 1;
			}
			.cap {
				position: absolute;
				top: 0;
				left: 0;
				width: 200px;	/* 220px */
				height: 200px;	/* 220px */
				background-color: pink;
				border-radius: 110px;
				border: 10px solid #CB83CB;	/* 边框增加了20px */
				opacity: 0.8;
				transform-origin: 212.5px center;
				/* 改变旋转点 */
				transform-origin: right;
				transition: 2s;
				z-index: 2;
			}
			.box:hover .cap{
				/* 实现翻盖效果 */
				/* transform: rotateX(-150deg); */
				transform: rotate(-150deg);
			}
			/* 旋转点 */
			.cap:after{
				position: absolute;
				display: block;
				content:"";
				width:8px;
				height: 8px;
				background-color: #000000;
				border-radius: 4px;
				left: 193.75px;
				top: 0;
				bottom: 0;
				margin: auto;
			}
		</style>
	</head>
	<body>
		<div class="main">
			<div class="box">
				<img src="img/1.jpg" />
				<div class="cap"></div>
			</div>
			<div class="box">
				<img src="img/2.jpg" />
				<div class="cap"></div>
			</div>
			<div class="box">
				<img src="img/3.jpg" />
				<div class="cap"></div>
			</div>
			<div class="box">
				<img src="img/4.jpg" />
				<div class="cap"></div>
			</div>
			<div class="box">
				<img src="img/5.jpg" />
				<div class="cap"></div>
			</div>
			<div class="box">
				<img src="img/6.jpg" />
				<div class="cap"></div>
			</div>
			<div class="box">
				<img src="img/7.jpg" />
				<div class="cap"></div>
			</div>
			<div class="box">
				<img src="img/8.jpg" />
				<div class="cap"></div>
			</div>
			<div class="box">
				<img src="img/9.jpg" />
				<div class="cap"></div>
			</div>
		</div>
	</body>
</html>

发布了56 篇原创文章 · 获赞 6 · 访问量 1834

猜你喜欢

转载自blog.csdn.net/qq_45832807/article/details/105225478