-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.css
59 lines (54 loc) · 1.25 KB
/
style.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
*, *::before, *::after {
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
}
.avatar {
width: 100px;
height: 100px;
border-radius: 50%;
background-image: url('https://source.unsplash.com/nKC772R_qog');
background-size: cover;
background-position: center;
position: relative;
}
.avatar::before,
.avatar::after {
--scale: 0;
--arrow-size: 10px;
--tooltip-color: #333;
position: absolute;
content: '';
top: -.25rem;
left: 50%;
transform: translateX(-50%) translateY(var(--translate-y, 0)) scale(var(--scale));
transition: 150ms transform;
transform-origin: bottom center;
}
.avatar::before {
--translate-y: calc(-100% - var(--arrow-size));
content: attr(data-tooltip);
color: white;
padding: .5rem;
border-radius: .3rem;
text-align: center;
width: max-content;
max-width: 100%;
background-color: var(--tooltip-color);
}
.avatar:hover::before,
.avatar:hover::after {
--scale: 1;
}
.avatar::after {
--translate-y: calc(-1 * var(--arrow-size));
content: '';
border: var(--arrow-size) solid transparent;
transform-origin: top center;
border-top-color: var(--tooltip-color);
}