玻璃拟态
实现原理(跟我想象的不一样,失败了)
渐变背景
background: linear-gradient(to right, #8f9aff, #ffcc70, #c850c0);
模糊
backdrop-filter: blur(10px);
阴影
box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.15);
渐变的细边框
GlassMorphism
ICBC bank
1000 0000 0000 0000 0001
Pan Rao
09/15
详细代码
vue
<template>
<main>
<div class="glass">
GlassMorphism
</div>
<div class="card">
<div class="bank">ICBC bank</div>
<div class="num">1000 0000 0000 0000 0001</div>
<div class="name">Pan Rao</div>
<div class="date">09/15</div>
<div class="circle"></div>
<div class="circle"></div>
</div>
</main>
</template>
<style scoped lang="scss">
main {
width: 100%;
height: 400px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(to right, #8f9aff, #ffcc70, #c850c0);
}
.glass {
font-size: 80px;
line-height: 100%;
font-weight: bold;
background: linear-gradient(to right, #ffcc70, #4150d0, #c850c0);
-webkit-background-clip: text;
color: transparent;
}
.card {
position: absolute;
width: 70%;
height: 300px;
color: #fff;
font-size: 30px;
border-radius: 20px;
backdrop-filter: blur(10px);
box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.15);
div {
position: absolute;
}
.bank {
left: 20px;
top: 20px;
}
.num {
left: 20px;
bottom: 60px;
}
.name {
left: 20px;
bottom: 30px;
font-size: 16px;
}
.date {
left: 20px;
bottom: 12px;
font-size: 16px;
}
.circle {
right: 20px;
top: 20px;
width: 50px;
height: 50px;
background: transparent;
border: 1.5px solid #fff;
border-radius: 100%;
}
.circle:last-child {
right: 50px;
}
}
</style>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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90