写个自适应相册还可以查看

在这里插入图片描述
手机端:
在这里插入图片描述
在这里插入图片描述

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<link rel="stylesheet" href="css/style.css" />
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js"></script>
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css"/>
	<title>Document</title>
</head>
<body>
	<div class="gallery-section">
		<div class="inner-width">
			<h1>My Gallery</h1>
			<div class="border"></div>
			<div class="gallery">
				<a href="img/1.jpg" class="image"><img src="img/1.jpg"/></a>
				<a href="img/2.jpg" class="image"><img src="img/2.jpg"/></a>
				<a href="img/3.jpg" class="image"><img src="img/3.jpg"/></a>
				<a href="img/4.jpg" class="image"><img src="img/4.jpg"/></a>
				<a href="img/5.jpg" class="image"><img src="img/5.jpg"/></a>
				<a href="img/6.jpg" class="image"><img src="img/9.jpg"/></a>
				<a href="img/7.jpg" class="image"><img src="img/7.jpg"/></a>
				<a href="img/8.jpg" class="image"><img src="img/8.jpg"/></a>
			</div>
		</div>
	</div>
</body>
<script>
	$(".gallery").magnificPopup({
		delegate:'a',
		type:'image',
		gallery:{
			enabled:true
		}
	});

</script>
</html>


css:

*{
	margin: 0;
	padding: 0;
	font-family: "microsoft sans serif";
	box-sizing: border-box;
}
.gallery-section{
	width: 100%;
	padding: 60px 0;
	background: #f1f1f1;
}
.inner-width{
	width: 100%;
	max-width: 1200px;
	margin: auto;
	padding: 0 20px;
}
.gallery-section h1{
	text-align: center;
	text-decoration: uppercase;
	color: #333;
}
.border{
	width: 180px;
	height: 4px;
	background: #333333;
	margin: 60px auto;
}
.gallery-section .gallery{
	display: flex;
	flex-wrap: wrap-reverse;
	justify-content: center;
}
.gallery-section .image{
	flex: 25%;
	overflow: hidden;
	cursor: pointer;
}
.gallery-section .image img{
	width: 100%;
	height: 100%;
	transition: 0.4s;
}
.gallery-section .image:hover img{
	transform: scale(1.4)rotate(15deg);
}
@media screen and (max-width:960px) {
	.gallery-section .image{
		flex: 33.33%;
	}
}
@media screen and (max-width:768px) {
	.gallery-section .image{
		flex: 50%;
	}
}
@media screen and (max-width:480px) {
	.gallery-section .image{
		flex: 100%;
	}
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值