html5的transition动画实例-鼠标滑过动画

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>ihover</title>
	<style>
		.box{
			width: 260px;
			height: 260px;
			margin: 0 auto;
			position: relative;
			overflow: hidden;
		}
		.img{
			height: 100%;
			width: 100%;
			background: url(2.jpg) center center / cover no-repeat;
		}
		.text{
			width: 100%;
			height: 30%;
			background-color:blue;
			position: absolute;
			top: 30%;
			left: 0; 
			transform: rotate(-45deg) rotateX(90deg);
			transition: 0.6s 0.9s ease-in-out;
			line-height: 70%;
			color: pink;
			font-size: 26px;
			text-align: center;
		}
		.img:after{
			content: "";
			position: absolute;
			width: 100%;
			height: 100%;
			top:0;
			left: 0;
			background: rgba(0,0,0,0.6);
			transform: translate(-149.99%) skew(-45deg);
			transition: 0.9s ease-in-out;
		}
		.img:before{
			content: "";
			position: absolute;
			width: 100%;
			height: 100%;
			top:0;
			left: 0;
			background: rgba(0,0,0,0.6);
			transform: translate(149.9%) skew(-45deg);
			transition: 0.9s ease-in-out;
		}
		.box:hover .img:after{
			transform: translate(-49.9%) skew(-45deg);
		}
		.box:hover .img:before{
			transform: translate(49.9%) skew(-45deg);
		}
		.box:hover .text{
			transform: rotate(0deg) rotateX(0deg);
		}
	</style>
</head>
<body>
	<div class="box">
		<div class="img"></div>
		<div class="text">welcome to 领哥
			<p>领哥成就你的吃瓜梦想</p>
		</div>
	</div>
</body>
</html>

当鼠标划过时,半透明遮罩从两侧合上,再从中间缝隙中弹出带有文字的背景,成品展示如下图所示:

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值