先上效果图
鼠标滑到某张图片时会放大
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<style>
.box {
width: 620px;
margin: 200px auto;
text-align: center;
color: #933;
}
.box ul {
list-style: none;
padding: 0;
/* 溢出属性,hidden隐藏,auto自动处理 */
}
.box ul li {
float: left; /*浮动元素横向排列,同时不占据空间大小,将会导致父元素的高度坍塌*/
margin: 3px;
padding: 5px;
border: 1px solid white;
border-color: #ddd #bbb #aaa #ccc;
background: #eee;
}
.box ul li img {
width: 100px;
height: 75px;
border: 1px solid white;
border-color: #aaa #ccc #ddd #bbb;
padding: 2px;
vertical-align: top; /*图片的默认上下对齐方式为baseline对齐,改为top即可*/
background: white;
}
/*鼠标滑到照片时的变化*/
.box ul li img:hover {
transform: scale(2); /*变形样式: 可以放大缩小、3D旋转*/
transition: all 1s; /*过渡样式: 将指定的属性在变化时产生过渡效果 即放慢变化速度*/
}
</style>
<body>
<div class="box">
<ul>
<li>
<img src="img/photo01.jpg" alt="description" />
</li>
<li>
<img src="img/photo02.jpg" alt="description" />
</li>
<li>
<img src="img/photo03.jpg" alt="description" />
</li>
<li>
<img src="img/photo04.jpg" alt="description" />
</li>
<li>
<img src="img/photo05.jpg" alt="description" />
</li>
<li>
<img src="img/photo06.jpg" alt="description" />
</li>
<li>
<img src="img/photo07.jpg" alt="description" />
</li>
<li>
<img src="img/photo08.jpg" alt="description" />
</li>
<li>
<img src="img/photo09.jpg" alt="description" />
</li>
<li>
<img src="img/photo10.jpg" alt="description" />
</li>
<li>
<img src="img/photo11.jpg" alt="description" />
</li>
<li>
<img src="img/photo12.jpg" alt="description" />
</li>
<li>
<img src="img/photo13.jpg" alt="description" />
</li>
<li>
<img src="img/photo14.jpg" alt="description" />
</li>
<li>
<img src="img/photo15.jpg" alt="description" />
</li>
<li>
<img src="img/photo16.jpg" alt="description" />
</li>
<li>
<img src="img/photo17.jpg" alt="description" />
</li>
<li>
<img src="img/photo18.jpg" alt="description" />
</li>
<li>
<img src="img/photo19.jpg" alt="description" />
</li>
<li>
<img src="img/photo20.jpg" alt="description" />
</li>
</ul>
</div>
</body>
</html>