web:简单照片墙放置,鼠标悬浮放大

简单利用position, transform,rotate制作如下照片墙效果,鼠标点击放大当前图片并且覆盖其他照片。

在这里插入图片描述
主体部分:index.html

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	
	#链接样式部分
	<link rel="stylesheet" type="text/css" href="css/new_file.css"/>
	</head>
	<body>
	
	<div class="box" id="box">
		#以下为图片地址
		<img src="img/10.jpg" >
		<img src="img/2.jpg" >
		<img src="img/3.jpg" >
		<img src="img/4.jpg" >
		<img src="img/5.jpg" >
		
		<img src="img/6.jpg" >
		<img src="img/7.jpg" >
		
		<img src="img/8.jpg" >
		<img src="img/9.jpg" >
		<img src="img/1.jpg" >
	</div>
	</body>
</html>

CSS部分:new_file.css

div img:nth-child(even){
			width: 200px;
			
		}
		div img:nth-child(odd){
			width: 300px;
		}
		.box{
			margin: 300px auto;
			width: 940px;
			position: relative;
		}
		.box img{
			padding: 1px solid #ddd;
			border: 10px;
			position: absolute;
			background: #fff;
			z-index:1;
		}
		.box img:nth-child(1){
			top: 0px;
			left: 30px;
			transform: rotate(-15deg);
		}
		.box img:nth-child(2){
			top: -50px;
			left: 600px;
			transform: rotate(-20deg);
		}
		.box img:nth-child(3){
			bottom: 0;
			right: 0;
			transform: rotate(15deg);
		}
		.box img:nth-child(4){
			bottom: 0;
			left: 400px;
			transform: rotate(-20deg);
		}
		.box img:nth-child(5){
			bottom: 0;
			left: 600px;
			transform: rotate(-30deg);
		}
		.box img:nth-child(6){
			top: 0;
			left: 0;
			transform: rotate(20deg);
		}
		.box img:nth-child(7){
			top: 0;
			left: 700px;
			transform: rotate(20deg);
		}
		.box img:nth-child(8){
			bottom: -20px;
			right: 500px;
			transform: rotate(30deg);
		}
		.box img:nth-child(9){
			top: 90px;
			left: 550px;
			transform: rotate(15deg);
		}
		.box img:nth-child(10){
			top: 20px;
			left: 350px;
			transform: rotate(-10deg);
		}
		#box img:hover{
			box-shadow: 5px 5px 5px #ddd;
			z-index: 2;
			transform: rotate(0deg) scale(1.5);
			
		}
  • 2
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值