2D波浪按钮

[每天一个]1.2D波浪按钮

预览图



预览链接

http://web.wanqqq29.cn/DailyCss/2Dwave/

wave.png下载链接

http://markdowntc.wanqqq29.cn//img/wave.png

思路

1

html 代码

1
2
3
4
5
6
7
<div class="wavebtn">
<a href="#">
<span>button</span>
<div class="wave"></div>
</a>
</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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
.wavebtn>a {
position: relative;
display: block;
padding: 10px 30px;
border: 2px solid #00aeff;
font-size: 18px;
letter-spacing: 4px;
color: #00aeff;
text-decoration: none;
overflow: hidden;
}

.wavebtn>a span {
position: relative;
z-index: 1;
transition: 1s;
}

.wavebtn>a:hover span {
color: #fff;
}

.wavebtn>a .wave {
position: absolute;
top: calc(100% + 22px);
left: 0;
width: 100%;
height: 100%;
background: #00aeff;
transition: 1s;
}

.wavebtn>a:hover .wave {
top: 0;
}

.wavebtn>a .wave:before {
content: ' ';
position: absolute;
top: -22px;
left: 0;
width: 100%;
height: 22px;
background: url(./wave.png);
animation: animate 0.5s linear infinite;
}

@keyframes animate {
0% {
background-position-x: 0;
background-position-y: -22px;
}
100% {
background-position-x: 118px;
background-position-y: -22px;
}
}

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!