Skip to content

Instantly share code, notes, and snippets.

@yjose
Last active May 5, 2017 08:45
Show Gist options
  • Save yjose/b9366f4e6f914529455e34751c5d82a1 to your computer and use it in GitHub Desktop.
Save yjose/b9366f4e6f914529455e34751c5d82a1 to your computer and use it in GitHub Desktop.
step1-tooltip.css
button{
margin:auto;
background: #3498db;
font-family: Arial;
color: #ffffff;
font-size: 14px;
}
[tooltip]{
margin:20px;
position:relative;
}
[tooltip]::before {
content: "";
position: absolute;
top:-6px;
left:50%;
transform: translateX(-50%);
border-width: 4px 6px 0 6px;
border-style: solid;
border-color: rgba(0,0,0,0.7) transparent transparent transparent;
z-index: 100;
}
[tooltip]::after {
content: attr(tooltip);
position: absolute;
left:50%;
top:-6px;
transform: translateX(-50%) translateY(-100%);
background: rgba(0,0,0,0.7);
text-align: center;
color: #fff;
padding:4px 2px;
font-size: 12px;
min-width: 80px;
border-radius: 5px;
pointer-events: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment