Google style tooltip
by Bacher
HTML
<div class="item">
<div class="tooltip">
Show super notification
</div>
</div>
<div class="item">
<div class="tooltip">
Make action, Make action
</div>
</div>
SCSS
.item {
display: inline-block;
width: 40px;
height: 40px;
background: gray;
&:hover .tooltip {
display: block;
}
}
.tooltip {
display: none;
position: absolute;
top: 50px;
padding: 5px;
width: 100px;
color: #fff;
max-width: 220px;
border-radius: 4px;
font-family: sans;
font-size: 11px;
overflow: hidden;
z-index: 1;
text-align: center;
animation: raise 0.12s;
&:before {
position: absolute;
border: 100px solid #323232;
border-radius: 50%;
transform: translate(0, -130px);
left: -50px;
content: "";
animation: raise-2 0.25s;
z-index: -1;
}
}
@keyframes raise {
0% {
transform: translate(0, 5px) scale(0.8);
opacity: 0;
}
100% {
transform: translate(0, 0) scale(1);
opacity: 1;
}
}
@keyframes raise-2 {
0% {
transform: translate(0, -180px);
}
100% {
transform: translate(0, -130px);
}
}