File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ < html lang ="en ">
2+ < head >
3+ < meta charset ="UTF-8 " />
4+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge " />
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6+ < title > Tooltip</ title >
7+ < link rel ="stylesheet " href ="style.css " />
8+ </ head >
9+ < body >
10+ < div id ="container ">
11+ < span id ="tooltip-content "> Tooltip Text</ span >
12+ < span > Hover Me</ span >
13+ </ div >
14+ </ body >
15+ </ html >
Original file line number Diff line number Diff line change 1+ * {
2+ padding : 0 ;
3+ margin : 0 ;
4+ box-sizing : border-box;
5+ }
6+
7+ body {
8+ width : 100% ;
9+ height : 100vh ;
10+ display : flex;
11+ justify-content : center;
12+ align-items : center;
13+ background : linear-gradient (# 8bc6ec, # 9599e2 );
14+ font-family : sans-serif;
15+ }
16+
17+ # container {
18+ position : relative;
19+ padding : 7px ;
20+ font-size : 25px ;
21+ font-weight : bold;
22+ cursor : pointer;
23+ }
24+
25+ # tooltip-content {
26+ position : absolute;
27+ left : 50% ;
28+ top : 0 ;
29+ transform : translateX (-50% );
30+ background : # 000 ;
31+ color : # fff ;
32+ white-space : nowrap;
33+ padding : 10px 15px ;
34+ border-radius : 7px ;
35+ visibility : hidden;
36+ opacity : 0 ;
37+ transition : opacity 0.5s ease;
38+ }
39+
40+ # tooltip-content ::before {
41+ content : "" ;
42+ position : absolute;
43+ left : 50% ;
44+ top : 100% ;
45+ transform : translateX (-50% );
46+ border : 15px solid;
47+ border-color : # 000 # 0000 # 0000 # 0000 ;
48+ }
49+
50+ # container : hover # tooltip-content {
51+ top : -130% ;
52+ visibility : visible;
53+ opacity : 1 ;
54+ }
You can’t perform that action at this time.
0 commit comments