-
Notifications
You must be signed in to change notification settings - Fork 19
/
tooltips.css
69 lines (58 loc) · 1.31 KB
/
tooltips.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
.tooltip {
position: relative;
}
.tooltip::before, .tooltip::after {
position: absolute;
left: 50%;
opacity: 0;
transition: all 0.1s ease-in-out;
pointer-events: none;
}
.tooltip::before {
content: "";
border-width: 10px 8px 0 8px;
border-style: solid;
border-color: #111 transparent transparent transparent;
top: -20px;
margin-left: -8px;
z-index: 1;
}
.tooltip::after {
content: attr(data-tooltip);
background: #111;
top: -20px;
transform: translateY(-100%) translateX(-50%);
font-size: 12px;
width: 80px;
border-radius: 10px;
color: var(--color-on);
padding: 12px;
z-index: 1;
display: flex;
justify-content: center;
align-items: center;
}
.tooltip.left::after, .tooltip:last-child::after {
transform: translateY(-100%) translateX(-80%);
}
.tooltip.bottom::before {
border-width: 0 8px 10px 8px;
border-color: transparent transparent #111 transparent;
top: 100%;
margin-top: 5px;
margin-left: -8px;
}
.tooltip.bottom::after {
top: 100%;
transform: translateY(0) translateX(-50%);
margin-top: 15px;
}
.tooltip.right::after {
transform: translateY(-1px) translateX(-25%);
}
.tooltip.long::after {
width: 150px;
}
.tooltip:hover::before, .tooltip:hover::after{
opacity: 1;
}