背景

内容就是一张卡片,当鼠标进入这个卡片时会出现一系列的动画

当进入这个图片时,四分之一的圆会变大,并且所有的内容会向上移动。

代码如下

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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>创意产品卡设计</title>
</head>
<body>
<div class="container">
<div class="card">
<div class="imgBx">
<img src="./imgs/upgrade.png" alt="">
</div>
<div class="contentBx">
<h2>李宁 跑步鞋</h2>
<div class="size">
<h3>Size: </h3>
<span>7</span>
<span>8</span>
<span>9</span>
<span>10</span>
</div>
<div class="color">
<h3>Color: </h3>
<span></span>
<span></span>
<span></span>
</div>
<a href="#">立即购买</a>
</div>
</div>
</div>
</body>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: '微软雅黑', sans-serif;
}

body{
display: flex;
align-items: center;
justify-content: center;
background-color: #131313;
min-height: 100vh;
}


.container{
position: relative;
}
.container .card{
position: relative;
width: 320px;
height: 450px;
background: #232323;
border-radius: 20px;
overflow: hidden;
}
.container .card::before{
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #9bdc28;
clip-path: circle(150px at 80% 20%);
transition: 0.5s ease-in-out;
}

.container .card:hover::before{
clip-path: circle(300px at 80% -20%);
}
.container .card .imgBx{
position: absolute;
top: 50%;
transform: translateY(-50%);
z-index: 1000;
height: 220px;
width: 100%;
transition: 0.5s;
}
.container .card:hover .imgBx{
top: 0%;
transform: translateY(0);
}

.container .card .imgBx img{
width: 270px;
height: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(-20deg);
}
.container .card .contentBx{
position: absolute;
bottom: 0;
width: 100%;
height: 100px;
text-align: center;
transition: 1s;
z-index: 0;
}
.container .card:hover .contentBx{
height: 210px;
}
.container .card .contentBx h2{
position: relative;
font-weight: 600;
letter-spacing: 1px;
color: #fff;
}
.container .card .contentBx .size,
.container .card .contentBx .color{
display: flex;
justify-content: center;
align-items: center;
padding: 8px 20px;
transition: 0.5s;
opacity: 0;
visibility: hidden;
}
.container .card:hover .contentBx .size{
opacity: 1;
visibility: visible;
transition-delay: 0.5s;
}
.container .card:hover .contentBx .color{
opacity: 1;
visibility: visible;
transition-delay: 0.5s;
}
.container .card .contentBx .size h3,
.container .card .contentBx .color h3{
color: #fff;
font-weight: 300;
font-size: 14px;
text-transform: uppercase;
letter-spacing: 2px;
margin-right: 10px;
}
.container .card .contentBx .size span{
width: 26px;
height: 26px;
text-align: center;
line-height: 26px;
font-size: 14px;
display: inline-block;
color: #111;
background-color: #fff;
margin: 0 5px;
border-radius: 4px;
cursor: pointer;
}
.container .card .contentBx .size span:hover{
background: #9bdc28;
}
.container .card .contentBx .color span{
width: 20px;
height: 20px;
background: #ff0;
border-radius: 50%;
margin: 0 5px;
cursor: pointer;
}
.container .card .contentBx .color span:nth-child(2){
background: #9bdc28;
}
.container .card .contentBx .color span:nth-child(3){
background: #03a9f4;
}
.container .card .contentBx .color span:nth-child(4){
background: #e91e63;
}
.container .card .contentBx a{
display: inline-block;
padding: 10px 20px;
background: #fff;
border-radius: 4px;
margin-top: 10px;
text-decoration: none;
font-weight: 600;
color: #111;
opacity: 0;
transform: translateY(50px);
transition: 0.5s;
}
.container .card:hover .contentBx a{
opacity: 1;
transform: translateY(0px);
transition-delay: 0.75s;
}
</style>
</html>