-
Notifications
You must be signed in to change notification settings - Fork 0
/
tooltip.css
86 lines (83 loc) · 2.1 KB
/
tooltip.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
/* -------------------------------------------------------------------
Light Weight Tooltip using css-only
@author mohammad ahshan danish
<div class="tooltip" data-tool-tip="I am testing">TEST</div>
<div class="tooltip" data-tool-tip-left="I am testing tooltip">TEST</div>
--------------------------------------------------------------------*/
[data-tool-tip-left] {
--background-color:#4b4849;
position: relative;
display: inline-block;
box-sizing: content-box;
}
[data-tool-tip-left]:hover:after, [data-tool-tip-left]:hover:before {
visibility: visible;
}
[data-tool-tip-left]:after {
position: absolute;
content: "";
border: 10px solid transparent;
border-left: 10px solid var(--background-color);
margin-bottom: 10px;
right: 100%;
transform: translateX(100%);
visibility: hidden;
z-index: 9999;
}
[data-tool-tip-left]:before {
position: absolute;
height: 22px;
padding: 10px;
padding-inline: 15px;
font-size: 20px;
content: attr(data-tool-tip-left);
white-space: nowrap;
background-color: var(--background-color);
color: white;
border-radius: 8px;
bottom: 100%;
margin-bottom: -30px;
transform: translateX(-99%);
visibility: hidden;
z-index: 9999;
}
[data-tool-tip] {
--background-color:#4b4849;
position: relative;
display: inline-block;
box-sizing: content-box;
z-index: 9999;
}
[data-tool-tip]:hover:after, [data-tool-tip]:hover:before {
visibility: visible;
}
[data-tool-tip]:before {
position: absolute;
content: "";
border: 10px solid transparent;
border-bottom: 10px solid var(--background-color);
bottom: -100%;
margin-bottom: 10px;
left: 50%;
transform: translateX(-50%);
visibility: hidden;
z-index: 9999;
}
[data-tool-tip]:after {
position: absolute;
height: 22px;
padding: 10px;
padding-inline: 15px;
font-size: 20px;
content: attr(data-tool-tip);
white-space: nowrap;
background-color: var(--background-color);
color: white;
border-radius: 8px;
bottom: -100%;
margin-bottom: -30px;
left: 50%;
transform: translateX(-50%);
visibility: hidden;
z-index: 9999;
}/*# sourceMappingURL=tooltip.css.map */