Created
July 16, 2018 22:57
-
-
Save BryanMoslo/808f7acb1dafcd049a1aebbeef8c2755 to your computer and use it in GitHub Desktop.
CSS Tooltip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button class="tooltip" tooltip-title="Save">Hover over me</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body{ | |
padding: 50px; | |
} | |
.tooltip { | |
position: relative; | |
} | |
.tooltip:before { | |
content: attr(tooltip-title); | |
min-width: 54px; | |
background-color: #999999; | |
color: #fff; | |
font-size: 12px; | |
border-radius: 4px; | |
padding: 9px 0; | |
position: absolute; | |
top: -42px; | |
left: 50%; | |
margin-left: -27px; | |
visibility: hidden; | |
opacity: 0; | |
transition: opacity 0.3s; | |
} | |
.tooltip:after { | |
content: ""; | |
position: absolute; | |
top: -9px; | |
left: 50%; | |
margin-left: -5px; | |
border-width: 5px; | |
border-style: solid; | |
border-color: #999999 transparent transparent; | |
visibility: hidden; | |
opacity: 0; | |
transition: opacity 0.3s; | |
} | |
.tooltip:hover:before, | |
.tooltip:hover:after{ | |
visibility: visible; | |
opacity: 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment