-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
77 lines (67 loc) · 1.57 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!doctype html>
<html lang="en">
<head>
<!-- stripped head tag, only necessary elements -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CSS Tooltip Demo</title>
<style>
/* css reset, basic styles */
*{
padding:0;
margin:0;
}
body{
font-family: sans-serif;
height:100vh;
display:flex;
align-items: center;
justify-content: center;
}
/* what is hovered on to show the tooltip, works best if this is an inline element */
[data-tooltip]{
position:relative;
cursor: pointer;
}
/* the tooltip itself */
[data-tooltip]:after{
/* container */
z-index:2;
pointer-events:none;
background-color:white;
border-radius: 10px;
width:350px;
border:1px solid #e3e3e3;
padding:20px;
box-shadow:0px;
position:absolute;
left:50%;
transform: translateX(-50%);
/* transition (closed) */
transition:.35s;
opacity:0;
bottom:70%;
/* content styles */
content:attr(data-tooltip);
text-transform: none;
font-size:14px;
font-weight:normal;
letter-spacing: normal;
text-align:left;
}
/* on hover, tooltip shows (open) */
[data-tooltip]:hover:after{
opacity:1;
bottom:150%;
box-shadow:0px 8px 17px -8px rgb(0 0 0 / 10%);
}
</style>
</head>
<body>
<section>
<p>
<span data-tooltip="Hello World, here is a tooltip!"> tooltip here!</span>
</p>
</section>
</body>
</html>