效果图
html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>新拟态</title>
<link rel="stylesheet" type="text/css" href="./css/新拟态.css"/>
</head>
<body>
<div class="container">
<div class="box">
<div class="img">
<img src="./img/地图.png" >
</div>
<p>地图</p>
</div>
<div class="box">
<div class="img">
<img src="./img/微信.png" >
</div>
<p>微信</p>
</div>
<div class="box">
<div class="img">
<img src="./img/QQ.png" >
</div>
<p>QQ</p>
</div>
<div class="box">
<div class="img">
<img src="./img/日历.png" >
</div>
<p>日历</p>
</div>
<div class="box">
<div class="img">
<img src="./img/时钟.png" >
</div>
<p>时钟</p>
</div>
<div class="box">
<div class="img">
<img src="./img/电话.png" >
</div>
<p>电话</p>
</div>
<div class="box">
<div class="img">
<img src="./img/相册.png" >
</div>
<p>相册</p>
</div>
<div class="box">
<div class="img">
<img src="./img/相机.png" >
</div>
<p>相机</p>
</div>
<div class="box">
<div class="img">
<img src="./img/邮箱.png" >
</div>
<p>邮箱</p>
</div>
<div class="box">
<div class="img">
<img src="./img/CN_bilibili.png" >
</div>
<p>bilibili</p>
</div>
<div class="box">
<div class="img">
<img src="./img/华为.png" >
</div>
<p>华为</p>
</div>
<div class="box">
<div class="img">
<img src="./img/小米.png" >
</div>
<p>小米</p>
</div>
<div class="box">
<div class="img">
<img src="./img/百度.png" >
</div>
<p>百度</p>
</div>
<div class="box">
<div class="img">
<img src="./img/设置.png" >
</div>
<p>设置</p>
</div>
<div class="box">
<div class="img">
<img src="./img/人.png" >
</div>
<p>我的</p>
</div>
</div>
</body>
</html>
CSS
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #efeeee;
}
/*
.container{
position: absolute;
display: grid;
grid-template-columns: repeat(3,1fr);
grid-template-rows: repeat(2,1fr);
grid-gap: 10px;
} */
.container{
width: 700px;
height: 600px;
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
}
.container .box{
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
align-content: center;
width: 100px;
height: 140px;
margin: 20px;
}
.container .box .img{
width: 60px;
height: 60px;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 18px 18px 30px rgba(0,0,0,.1),
-18px -18px 30px rgba(255,255,255,1);
border-radius: 20px;
background-color: #EFEEEE;
transition: box-shadow .2s ease-out;
}
.container .box .img img{
width: 30px;
transition: width .2s ease-out;
}
.container .box .img p{
color: slategray;
}
.container .box .img:hover{
box-shadow: 0px 0px 0px rgba(0,0,0,.1),
0px 0px 0px rgba(255,255,255,1),
inset 18px 18px 30px rgba(0,0,0,.1),
inset -18px -18px 30px rgba(255,255,255,1);
transition: box-shadow .2s ease-out;
}
.container .box .img:hover img{
width: 29px;
transition: width .2s ease-out;
}