Last active
August 29, 2015 14:22
-
-
Save rpearce/8f0f1dd29e5daf6de270 to your computer and use it in GitHub Desktop.
Great tooltip that sadly isn't accessible :(
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
<p> | |
Slow-carb Tumblr High Life biodiesel, stumptown keytar art party mumblecore PBR next level chillwave McSweeney's meh butcher Bushwick. | |
Twee try-hard meditation viral, master cleanse butcher pour-over Pitchfork Vice <span data-tooltip="This is a wide tooltip">farm-to-table</span> paleo Portland brunch. | |
Ugh plaid lomo YOLO food truck, mustache migas +1 viral health goth tousled. Tofu chambray Portland chillwave chia authentic. | |
Typewriter hoodie freegan Intelligentsia fashion axe. <span data-tooltip="Something to say here">Listicle +1 craft beer tattooed mlkshk jean</span> shorts, Banksy ethical selfies Pitchfork Portland irony. | |
Tattooed four loko cardigan, ugh cold-pressed heirloom ennui meditation fap literally authentic migas. | |
</p> |
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; | |
display: inline-block; | |
box-sizing: border-box; | |
border-bottom: 3px solid #b4e7f8; | |
-webkit-box-shadow: inset 0 -5px 0 #b4e7f8; | |
box-shadow: inset 0 -5px 0 #b4e7f8; | |
} | |
[data-tooltip]:before, | |
[data-tooltip]:after { | |
display: none; | |
position: absolute; | |
bottom: 100%; | |
left: 50%; | |
box-sizing: inherit; | |
-webkit-transform: translateX(-50%); | |
-ms-transform: translateX(-50%); | |
transform: translateX(-50%); | |
} | |
[data-tooltip]:before { | |
content: attr(data-tooltip); | |
padding: 3px 10px; | |
border-radius: 3px; | |
background-color: #222; | |
color: #FFF; | |
white-space: nowrap; | |
font-size: 0.778rem | |
} | |
[data-tooltip]:after { | |
content: ""; | |
border: 5px solid transparent; | |
border-top: 5px solid #222; | |
margin-bottom: -10px; | |
} | |
[data-tooltip]:hover:before, | |
[data-tooltip]:hover:after, | |
[data-tooltip]:active:before, | |
[data-tooltip]:active:after { | |
display: block; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment