-
Notifications
You must be signed in to change notification settings - Fork 0
/
tooltip.scss
107 lines (95 loc) · 2.56 KB
/
tooltip.scss
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
/* -------------------------------------------------------------------
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;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
&:hover {
&:after,
&:before {
visibility: visible;
}
}
&:after {
position: absolute;
content: "";
border: 10px solid transparent;
border-left: 10px solid var(--background-color);
// bottom: -100%;
margin-bottom: 10px;
right: 100%;
transform: translateX(100%);
visibility: hidden;
z-index: 9999;
}
&: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;
// right: 50%;
transform: translateX(-99%);
visibility: hidden;
z-index: 9999;
}
}
[data-tool-tip] {
--background-color:#4b4849;
position: relative;
display: inline-block;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
z-index: 9999;
&:hover {
&:after,
&:before {
visibility: visible;
}
}
&: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;
}
&: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;
}
}