二维码
coderljw 2024-10-13 小于 1 分钟
<main>
<section></section>
</main>
1
2
3
2
3
main {
height: 400px;
display: grid;
place-items: center;
}
section {
width: 200px;
height: 200px;
position: relative;
background: url(../../images/qr-code.png) center/cover no-repeat;
}
section::before {
content: ' ';
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: linear-gradient(45deg, rgb(51, 102, 153), rgb(255, 0, 204));
/* 中间留空,头像不上色 */
-webkit-mask: radial-gradient(
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0) 15%,
rgb(0, 0, 0) 15%
);
mix-blend-mode: lighten;
}
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
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
<main>
<section>
<div class="qr-code">
<div class="line"></div>
</div>
</section>
</main>
1
2
3
4
5
6
7
2
3
4
5
6
7
main {
height: 400px;
display: grid;
place-items: center;
--color: #0f3;
}
section {
position: relative;
width: 200px;
height: 200px;
overflow: hidden;
box-shadow: inset 0 0 0 3px var(--color);
}
section::before {
content: ' ';
position: absolute;
top: 50%;
left: 50%;
width: 200%;
height: 80%;
transform: translate(-50%, -50%);
background: #fff;
}
section::after {
content: ' ';
position: absolute;
top: 50%;
left: 50%;
width: 80%;
height: 200%;
transform: translate(-50%, -50%);
background: #fff;
}
.qr-code {
position: absolute;
overflow: hidden;
z-index: 1;
top: 50%;
left: 50%;
width: 98%;
height: 98%;
transform: translate(-50%, -50%);
background: url(../../images/qr-code.png) center/cover no-repeat;
}
.line {
position: relative;
width: 100%;
height: 100%;
transform: translateY(-100%);
border-bottom: 3px solid var(--color);
animation: radar-beam 2s cubic-bezier(0.53, 0, 0.43, 0.99) infinite;
background: linear-gradient(180deg, transparent 43%, var(--color) 211%);
}
@keyframes radar-beam {
0% {
transform: translateY(-100%);
}
100% {
transform: translateY(0);
}
}
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
58
59
60
61
62
63
64
65
66
67
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
58
59
60
61
62
63
64
65
66
67