-
Notifications
You must be signed in to change notification settings - Fork 0
/
139.css
129 lines (129 loc) · 2.74 KB
/
139.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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
*{
margin: 0;
padding: 0;
}
body{
/* 弹性布局 居中显示 */
display: flex;
justify-content: center;
align-items: center;
/* 渐变背景 */
background: #f5f7fa;
}
.card-container{
display: flex;
justify-content: center;
align-items: center;
/* 允许换行 */
flex-wrap: wrap;
max-width: 100%;
}
.card{
position: relative;
width: 200px;
height: 300px;
margin: 10px;
display: flex;
align-items: flex-end;
text-align: center;
color: #f5f5f5;
/* 阴影 */
box-shadow: 0 1px 1px rgba(0,0,0,0.1),
0 2px 2px rgba(0,0,0,0.1),
0 4px 4px rgba(0,0,0,0.1),
0 8px 8px rgba(0,0,0,0.1),
0 16px 16px rgba(0,0,0,0.1);
/* 溢出隐藏 */
overflow: hidden;
}
.card::before{
content: "";
width: 100%;
height: 110%;
position: absolute;
top: 0;
left: 0;
/* background-image: url(/images/139/1.jpg); */
/* 过渡效果: css属性名 时长 贝塞尔曲线 */
transition: transform 1s cubic-bezier(0.19,1,0.22,1);
}
/* 遮罩 */
.card::after{
content: "";
display: block;
width: 100%;
height: 200%;
background: linear-gradient(to bottom,
rgba(0,0,0,0) 0%,
rgba(0,0,0,0.25) 55%,
rgba(0,0,0,0.8) 100%);
/* 绝对定位 */
position: absolute;
left: 0;
top: 0;
transform: translateY(0);
/* 过渡效果 */
transition: transform 1.4s cubic-bezier(0.19,1,0.22,1);
}
.card .content{
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
z-index: 1;
padding: 16px 8px;
transform: translateY(76%);
transition: transform 0.7s cubic-bezier(0.19,1,0.22,1);
}
.card h2{
font-size: 23px;
font-weight: bold;
}
.card p{
font-size: 15px;
/* 字间距 */
letter-spacing: 2px;
width: 80%;
line-height: 30px;
margin-top: 25px;
/* 文本两端对齐 */
text-align: justify;
}
.card button{
cursor: pointer;
border: none;
background-color: rgba(0,0,0,0.5);
color: #fff;
padding: 12px 24px;
font-size: 12px;
font-weight: bold;
margin-top: 25px;
}
.card button:hover{
background-color: #000;
}
.card .content *:not(h2){
/* .content下,除了h2,其他元素隐藏并下移20px */
opacity: 0;
transform: translateY(20px);
transition: transform 0.7s cubic-bezier(0.19,1,0.22,1),opacity 0.7s cubic-bezier(0.19,1,0.22,1);
}
.card:hover{
align-items: center;
}
.card:hover::before{
transform: translateY(-5%);
}
.card:hover::after{
transform: translateY(-50%);
}
.card:hover .content{
transform: translateY(0);
}
.card:hover .content *:not(h2){
opacity: 1;
transform: translateY(0);
/* 过渡效果延迟 */
transition-delay: 0.1s;
}