按钮

点击效果

HTML

1
<div class="button">点击效果</div>

CSS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
.button{
position: relative;
width: 150px;
height: 50px;
line-height: 50px;
font-size: 16px;
text-align: center;
border: 1px solid #ccc;
background: #eee;
overflow: hidden;
user-select: none;
cursor: pointer;
}
.button:after{
position: absolute;
content: '';
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #333;
opacity: 0;
transition: all .5s;
}
.button:active:after{
top: 50%;
left: 50%;
width: 0;
height: 0;
opacity: .3;
transition: all 0s;
}

最后更新: 2024年04月12日 02:35

原始链接: https://xiaguochang.github.io/posts/19701066/