HTML5+CSS3实现图片的缩放旋转,一眼就懂

HTML界面

<html>
	<head>
		<meta charset="UTF-8">
		<title>照片墙</title>
		<link rel="stylesheet" type="text/css" href="../css/pictureWall.css"/>
	</head>
	<body>
		<h2>照片墙</h2>
		<div>
			<img src="../picWallImg/01.jpg" width="200px" height="150px"/>
			<img src="../picWallImg/02.jpg" width="230px" height="180px"/>
			<img src="../picWallImg/03.jpg" width="200px" height="300px"/>
			<img src="../picWallImg/04.jpg" width="150px" height="200px"/>
		</div>
	</body>
</html>

CSS样式设置

*{
	padding: 0px;
	margin: 0px;
	border: 0px;
}
h2{
	font-size: 50px;
	text-align: center;
}
div{
	width: 1100px;
	height: 400px;
	background-color:#CCCCCC ;
	margin: 100px auto;
	position: relative;
}
img{
	position: absolute;
	padding:10px ;
	background-color:#fff ;
	cursor: pointer;
}
img:nth-of-type(1){
	margin-top: 100px;
	margin-left:100px ;
	transform: rotate(20deg);
	z-index: 1;
}
img:nth-of-type(2){
	margin-top: 100px;
	margin-left:280px ;
	transform: rotate(-40deg);
	z-index: 2;
}
img:nth-of-type(3){
	margin-top: 50px;
	margin-left:530px ;
	transform: rotate(20deg);
	z-index: 3;
}
img:nth-of-type(4){
	margin-top: 130px;
	margin-left:750px ;
	transform: rotate(50deg);
	z-index: 2;
}

鼠标悬停动作设置

img:hover{
	transform: scale(2);
	transition: all 3s;
	box-shadow: 10px 10px 30px #ccc;
	z-index: 10;
}

结果展示

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值