Last active
October 26, 2016 07:12
-
-
Save jiripudil/3ff71e07f8b82e1ced2571aff4cbf06d to your computer and use it in GitHub Desktop.
Purce CSS tooltip - demo: https://jsfiddle.net/yp1tL5ft/
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
<span data-tooltip="Look ma, I am a tooltip!">Hover over me!</span> |
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
[data-tooltip] { | |
position: relative; | |
border-bottom: 1px dotted #666; | |
&:hover::before { | |
content: ''; | |
pointer-events: none; | |
display: block; | |
box-sizing: border-box; | |
position: absolute; | |
top: 100%; | |
left: 8px; | |
width: 4px; | |
height: 4px; | |
border: 4px solid transparent; | |
border-bottom-color: #222; | |
} | |
&:hover::after { | |
content: attr(data-tooltip); | |
pointer-events: none; | |
display: block; | |
box-sizing: border-box; | |
position: absolute; | |
top: calc(100% + 8px); | |
left: 0; | |
width: 100%; | |
padding: 8px; | |
font-size: 12px; | |
line-height: 1; | |
background: #222; | |
color: #fff; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment