Skip to content

Instantly share code, notes, and snippets.

@aaronvanston
Created September 11, 2016 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronvanston/29bc06aabef814bd230481371eee6aec to your computer and use it in GitHub Desktop.
Save aaronvanston/29bc06aabef814bd230481371eee6aec to your computer and use it in GitHub Desktop.
[data-tip] {
position: relative;
}
[data-tip]:before {
content: '';
position: absolute;
top: 100%;
left: calc(50% - 6px);
margin-top: -6px;
pointer-events: none;
border: 6px solid transparent;
border-bottom-color: #333;
}
[data-tip]:after {
content: attr(data-tip);
position: absolute;
top: 100%;
left: 50%;
margin-top: 6px;
background-color: #333;
color: #fff;
border-radius: 4px;
white-space: nowrap;
font-size: 0.8em;
padding: 0.5em 1em;
z-index: 100;
transform: translate(-50%, 0);
}
[data-tip]:before,
[data-tip]:after {
position: absolute;
top: 100%;
z-index: 100;
visibility: hidden;
opacity: 0;
}
[data-tip]:hover:before,
[data-tip]:hover:after {
visibility: visible;
opacity: 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment