新拟态.html
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="text.css">
</head>
<body>
<!-- 整个大的盒子 -->
<div class="container">
<!-- 每个图标的小盒子 -->
<div class="box">
<!-- 放图片的小盒子 -->
<div class="img">
<!-- 图标,可以到阿里巴巴矢量图标库下载 -->
<img src="播放.png" alt="">
</div>
<p>播放</p>
</div>
<div class="box">
<!-- 放图片的小盒子 -->
<div class="img">
<!-- 图标,可以到阿里巴巴矢量图标库下载 -->
<img src="时钟.png" alt="">
</div>
<p>时钟</p>
</div>
</div>
</body>
</html>
新拟态.css
css
* {
margin: 0;
padding: 0;
}
body {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #efeeee;
}
.container {
width: 700px;
height: 600px;
display: flex;
justify-content: space-around;
flex-wrap: wrap;
align-items: center;
}
.container .box {
display: flex;
justify-content: space-around;
flex-direction: column;
align-items: center;
align-content: center;
width: 100px;
height: 140px;
margin: 20px;
}
.container .box .img {
width: 100px;
height: 100px;
box-shadow: 18px 18px 30px rgba(0, 0, 0, 0.1), -18px -18px 30px rgba(255, 255, 255, 1);
border-radius: 20px;
display: flex;
align-items: center;
justify-content: center;
background-color: #efeeee;
transition: box-shadow .2s ease-out;
position: relative;
}
.container .box .img img {
width: 60px;
transition: width .2s ease-out;
}
.container .box p {
color: slategray;
}
.container .box .img:hover {
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.1), 0px 0px 0px rgba(255, 255, 255, 0.8), inset 18px 18px 30px rgba(0, 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: 58px;
transition: width .2s ease-out;
}
演示gif
很顺滑的样子OωO