过渡与变形应用

过渡与变形

此代码运用了transition属性、transform属性以及2D变形来实现过渡及变形效果

html代码如下:


<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>过渡和变形</title>
	<link rel="stylesheet" type="text/css" href="效果样式.css">
	</head>
	<body>
		<div class="box">
		<div class="pic">
		shape
		<div class="b">
			<img src="1.jpg" width="150" height="150"/>
		</div>
		</div>
		<div class="pic">
		displacement
		<div class="b">
		<img src="2.jpg" width="150" height="150"/>
		</div>
		</div>
		<div class="pic">
		position
		<div class="b">
			<img src="3.jpg" width="150" height="150"/>
			</div>
		</div>
		<div class="pic">
		color
		<div class="b">
			<img src="4.jpg" width="150" height="150"/>
			</div>
		</div>
		</div>
	</body>
</html>

css效果代码

.box{
			width:800px;
			height:250px;
			background-color: #000000;
			margin:100px auto;
		}
		.box .pic{
			width:160px;
			height:200px;
			margin-left: 30px;
			margin-top: 30px;
			font-size:12px;
			color:white;
			text-align: center;
			float:left;
		}
		.box .pic .b{
			width:150px;
			height: 150px;
			margin-top: 10px;
			border:5px solid white;
			border-radius:5px;
		}
		.box .pic .b img{
			width:150px;
			height:150px;
		}
		.box .pic:nth-child(1) .b:hover{
			border-radius:50%;
		}
		.box .pic .b{
			width:150px;
			height:150px;
			margin-top: 10px;
			border:5px solid white;
			border-radius:5px;
			transition:all 0.5s;
		}
		.box .pic .b img{
			width:150px;
			height:150px;
			transition: all 0.5s;
		}
		.box .pic:nth-child(2) .b img:hover{
			transform: scale(2);
		}
		.box .pic .b{
			width:150px;
			height: 150px;
			margin-top: 10px;
			border:5px solid white;
			border-radius:5px;
			transition:all 0.5s;
			overflow: hidden;
		}
		.box .pic:nth-child(3) .b:hover{
			transform:rotate(20deg);
		}
		.box .pic:nth-child(4) .b img:hover{
			filter:grayscale(100%)
		}
		.box .pic .b:hover{
			box-shadow:0px 0px 40px plum;
		}

效果图:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值