代码语言:javascript复制
/* 布局样式 */
body {
width: 100%;
height: 100vh;
justify-content: center;
align-items: center;
background-color: #eee;
color: slategray;
display:flex;
flex-wrap: wrap;
}
.container {
justify-content: center;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
margin: 20px;
}
/* 拟态样式 */
.container .box {
width: 99px;
height: 99px;
box-shadow: 9px 9px 15px rgba(0, 0, 0, 0.1),
-9px -9px 15px rgba(255, 255, 255, 1);
border-radius: 15px;
background-color: #eee;
transition: box-shadow .2s ease-out;
}
.container .box:hover {
box-shadow: 0 0 0 rgba(0, 0, 0, 0.2),
0 0 0 rgba(255, 255, 255, 0.8),
inset 9px 9px 15px rgba(0, 0, 0, 0.1),
inset -9px -9px 15px rgba(255, 255, 255, 1);
transition: box-shadow .2s ease-out;
}
代码语言:javascript复制<div class="container">
<div class="box"></div>
<p>十玖八柒</p>
</div>