1//When you hover over the word "hello" the text "goodbye" will appear
2in a small box
3<a href="./####" title = "goodbye" >hello</a>
1<!--
2A tooltip is use to specify extra information about something when user moves cursor over an HTML element.
3-->
4
5<!DOCTYPE html>
6<html>
7<style>
8.tooltip {
9 position: relative;
10 display: inline-block;
11 border-bottom: 1px dotted black;
12}
13
14.tooltip .tooltiptext {
15 visibility: hidden;
16 width: 120px;
17 background-color: black;
18 color: #fff;
19 text-align: center;
20 border-radius: 6px;
21 padding: 5px 0;
22 position: absolute;
23 z-index: 1;
24 bottom: 150%;
25 left: 50%;
26 margin-left: -60px;
27}
28
29.tooltip .tooltiptext::after {
30 content: "";
31 position: absolute;
32 top: 100%;
33 left: 50%;
34 margin-left: -5px;
35 border-width: 5px;
36 border-style: solid;
37 border-color: black transparent transparent transparent;
38}
39
40.tooltip:hover .tooltiptext {
41 visibility: visible;
42}
43</style>
44<body style="text-align:center;">
45
46<div class="tooltip">Hover over me
47 <span class="tooltiptext">Tooltip text</span>
48</div>
49
50</body>
51</html>
52
53<!--
54I Hope it will help you.
55Namaste
56Stay Home Stay Safe
57-->
1document.getElementById("myIdReference").title = 'my tooltip text'
2
3/* insta: @9_tay */
1<html>
2<style>
3.tooltip {
4 position: relative;
5 display: inline-block;
6 border-bottom: 1px dotted black;
7}
8
9.tooltip .tooltiptext {
10 visibility: hidden;
11 width: 120px;
12 background-color: black;
13 color: #fff;
14 text-align: center;
15 border-radius: 6px;
16 padding: 5px 0;
17 position: absolute;
18 z-index: 1;
19 bottom: 150%;
20 left: 50%;
21 margin-left: -60px;
22}
23
24.tooltip .tooltiptext::after {
25 content: "";
26 position: absolute;
27 top: 100%;
28 left: 50%;
29 margin-left: -5px;
30 border-width: 5px;
31 border-style: solid;
32 border-color: black transparent transparent transparent;
33}
34
35.tooltip:hover .tooltiptext {
36 visibility: visible;
37}
38</style>
39<body style="text-align:center;">
40
41<div class="tooltip">Hover over me
42 <span class="tooltiptext">Tooltip text</span>
43</div>
44
45</body>
46</html>
1
2<span data-tooltip="Tooltip help here!" data-flow="right">CSS Tooltips</span>
3
4<style>
5[data-tooltip] {
6 position: relative;
7 cursor: pointer;
8}
9[data-tooltip]:before,
10[data-tooltip]:after {
11 line-height: 1;
12 font-size: .9em;
13 pointer-events: none;
14 position: absolute;
15 box-sizing: border-box;
16 display: none;
17 opacity: 0;
18}
19[data-tooltip]:before {
20 content: "";
21 border: 5px solid transparent;
22 z-index: 100;
23}
24[data-tooltip]:after {
25 content: attr(data-tooltip);
26 text-align: center;
27 min-width: 3em;
28 max-width: 21em;
29 white-space: nowrap;
30 overflow: hidden;
31 text-overflow: ellipsis;
32 padding: 4px 12px;
33 border-radius: 9px;
34 background: #4621FF;
35 color: #FFFFFF;
36 z-index: 99;
37 text-shadow: 2px 0px 0px #800000;
38}
39[data-tooltip]:hover:before,
40[data-tooltip]:hover:after {
41 display: block;
42 opacity: 1;
43}
44[data-tooltip]:not([data-flow])::before,
45[data-tooltip][data-flow="top"]::before {
46 bottom: 100%;
47 border-bottom-width: 0;
48 border-top-color: #4621FF;
49}
50[data-tooltip]:not([data-flow])::after,
51[data-tooltip][data-flow="top"]::after {
52 bottom: calc(100% + 5px);
53}
54[data-tooltip]:not([data-flow])::before, [tooltip]:not([data-flow])::after,
55[data-tooltip][data-flow="top"]::before,
56[data-tooltip][data-flow="top"]::after {
57 left: 50%;
58 -webkit-transform: translate(-50%, -4px);
59 transform: translate(-50%, -4px);
60}
61[data-tooltip][data-flow="bottom"]::before {
62 top: 100%;
63 border-top-width: 0;
64 border-bottom-color: #4621FF;
65}
66[data-tooltip][data-flow="bottom"]::after {
67 top: calc(100% + 5px);
68}
69[data-tooltip][data-flow="bottom"]::before, [data-tooltip][data-flow="bottom"]::after {
70 left: 50%;
71 -webkit-transform: translate(-50%, 8px);
72 transform: translate(-50%, 8px);
73}
74[data-tooltip][data-flow="left"]::before {
75 top: 50%;
76 border-right-width: 0;
77 border-left-color: #4621FF;
78 left: calc(0em - 5px);
79 -webkit-transform: translate(-8px, -50%);
80 transform: translate(-8px, -50%);
81}
82[data-tooltip][data-flow="left"]::after {
83 top: 50%;
84 right: calc(100% + 5px);
85 -webkit-transform: translate(-8px, -50%);
86 transform: translate(-8px, -50%);
87}
88[data-tooltip][data-flow="right"]::before {
89 top: 50%;
90 border-left-width: 0;
91 border-right-color: #4621FF;
92 right: calc(0em - 5px);
93 -webkit-transform: translate(8px, -50%);
94 transform: translate(8px, -50%);
95}
96[data-tooltip][data-flow="right"]::after {
97 top: 50%;
98 left: calc(100% + 5px);
99 -webkit-transform: translate(8px, -50%);
100 transform: translate(8px, -50%);
101}
102[data-tooltip=""]::after, [data-tooltip=""]::before {
103 display: none ;
104}
105</style>