<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
body{
background:#f5f5f5;
}
ul{
list-style: none;
display: flex;
justify-content:left;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
width: 992px;
}
.box{
margin: 100px;
}
ul li img{
width: 160px;
height: 160px;
}
li{
position: relative;
z-index: 1;
width: 234px;
margin-left: 14px;
margin-bottom: 14px;
background: #fff;
-webkit-transition: all .2s linear;
transition: all .2s linear;
height: 300px;
}
a{
text-decoration: none;
color: black;
display: block;
height: 100%;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 20px 0;
}
.item-m{
width: 150px;
height: 150px;
margin: 0 auto 18px;
}
.title{
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
li:hover{
-webkit-box-shadow: 0 15px 30px rgb(0 0 0 / 10%);
box-shadow: 0 15px 30px rgb(0 0 0 / 10%);
-webkit-transform: translate3d(0,-2px,0);
transform: translate3d(0,-2px,0);
}
</style>
</head>
<body>
<div class="box">
<ul>
<li>
<a href="">
<div class="item-m">
<img src="./1.jpg" alt="">
</div>
<p class="title">
Redmi 10A
</p>
<p class="title">
大电量、大音量、大屏幕
</p>
</a>
</li>
<li>
<a href="">
<div class="item-m">
<img src="./1.jpg" alt="">
</div>
<p class="title">
Redmi 10A
</p>
<p class="title">
大电量、大音量、大屏幕
</p>
</a>
</li>
<li>
<a href="">
<div class="item-m">
<img src="./1.jpg" alt="">
</div>
<p class="title">
Redmi 10A
</p>
<p class="title">
大电量、大音量、大屏幕
</p>
</a>
</li>
<li>
<a href="">
<div class="item-m">
<img src="./1.jpg" alt="">
</div>
<p class="title">
Redmi 10A
</p>
<p class="title">
大电量、大音量、大屏幕
</p>
</a>
</li>
<li>
<a href="">
<div class="item-m">
<img src="./1.jpg" alt="">
</div>
<p class="title">
Redmi 10A
</p>
<p class="title">
大电量、大音量、大屏幕
</p>
</a>
</li>
<li>
<a href="">
<div class="item-m">
<img src="./1.jpg" alt="">
</div>
<p class="title">
Redmi 10A
</p>
<p class="title">
大电量、大音量、大屏幕
</p>
</a>
</li>
<li>
<a href="">
<div class="item-m">
<img src="./1.jpg" alt="">
</div>
<p class="title">
Redmi 10A
</p>
<p class="title">
大电量、大音量、大屏幕
</p>
</a>
</li>
<li>
<a href="">
<div class="item-m">
<img src="./1.jpg" alt="">
</div>
<p class="title">
Redmi 10A
</p>
<p class="title">
大电量、大音量、大屏幕
</p>
</a>
</li>
</ul>
</div>
</body>
</html>
css3 鼠标移动到上方增加阴影增加往前移动
最新推荐文章于 2023-02-25 01:52:10 发布