重要属性:
:active 选择器用于选择活动链接。
box-shadow: inset 将外部阴影 (outset) 改为内部阴影。
<style>>
.button {
overflow: hidden;
height: 80px;
background: #7fb1bf;
cursor: pointer;
color: #fff;
font-size: 40px;
letter-spacing: 1px;
text-shadow: rgb(0 0 0 / 90%) 0 1px 8px;
border-radius: 20px;
-o-box-shadow: hsla(0, 0%, 100%, .25) 0 1px 0,
inset hsla(0, 0%, 100%, .25) 0 1px 0,
inset rgba(0, 0, 0, .25) 0 0 0,
inset hsla(0, 0%, 100%, .03) 0 20px 0,
inset rgba(0, 0, 0, .15) 0 -20px 20px,
inset hsla(0, 0%, 100%, .05) 0 20px 20px;
box-shadow: 0 1px 0 hsl(0deg 0% 100% / 25%),
inset 0 1px 0 hsl(0deg 0% 100% / 25%),
inset 0 0 0 rgb(0 0 0 / 25%),
inset 0 20px 0 hsl(0deg 0% 100% / 3%),
inset 0 -20px 20px rgb(0 0 0 / 15%),
inset 0 20px 20px hsl(0deg 0% 100% / 5%);
-webkit-transition: all .1s linear;
transition: all .1s linear;
}
.button:active {
box-shadow: inset 0px 0px 2px 2px rgb(78, 78, 78);
}
</style>
<body>
<h2>按钮动画 - "按压效果"</h2>
<button class="button">Click Me</button>
</body>