Tooltip
A hover tooltip with arrow pointer and fade-in animation.
tooltip
hover
animation
Preview
Loading preview...
HTML
<div class="tooltip">Hover me</div>
CSS
.tooltip {
position: relative;
display: inline-block;
padding: 8px 16px;
background: #333;
color: white;
border-radius: 4px;
cursor: pointer;
}
.tooltip::after {
content: "This is a tooltip";
position: absolute;
bottom: 125%;
left: 50%;
transform: translateX(-50%);
background: #333;
color: white;
padding: 8px 12px;
border-radius: 4px;
font-size: 14px;
white-space: nowrap;
opacity: 0;
visibility: hidden;
transition: opacity 0.3s, visibility 0.3s;
z-index: 1;
}
.tooltip::before {
content: "";
position: absolute;
bottom: 115%;
left: 50%;
transform: translateX(-50%);
border: 5px solid transparent;
border-top-color: #333;
opacity: 0;
visibility: hidden;
transition: opacity 0.3s, visibility 0.3s;
}
.tooltip:hover::after,
.tooltip:hover::before {
opacity: 1;
visibility: visible;
}