-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
63 lines (57 loc) · 1.25 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Animating box shadows</title>
<style>
.card {
margin: 100px;
position: relative;
width: 100px;
height: 100px;
background-color: #f30;
border: 2px solid #f30;
}
.one {
transition: box-shadow 0.2s ease-in-out;
}
.one:hover {
box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
}
.two:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
z-index: -1;
opacity: 0;
transform: scale(0.75);
transition: all 0.2s ease-in-out;
will-change: transform;
}
.two:hover:before {
opacity: 1;
transform: none;
}
* {
box-sizing: border-box;
margin: 0;
}
body {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
</head>
<body>
<div class="card one"></div>
<div class="card two"></div>
</body>
</html>