Accessible, animated tooltips using only CSS and data attributes
Tooltips can appear on any side of an element
data-tooltip attribute with CSS ::before pseudo-element to create the tooltip content, and ::after for the arrow. Position is controlled with absolute positioning relative to the parent.
Different color variants for semantic meaning
Commonly used with icon-only buttons for accessibility
aria-label attributes to ensure screen reader users understand their purpose.
Tooltips can contain longer text that wraps to multiple lines
Small, medium (default), and large tooltip sizes
Tooltips can be applied to inline text elements for contextual help
The HTML standard is maintained by the W3C. Modern web development also uses CSS and JavaScript to create interactive experiences.
Use tooltips to provide contextual help for form inputs
Complete demonstration of all tooltip positions with different colors
Enhanced tooltips with glow and animation effects
:hover and :focus-visibletabindex="0" to make them keyboard accessiblecursor: help to indicate additional information is availablearia-describedby with JavaScript-enhanced tooltips<button class="tooltip tooltip-top"
data-tooltip="Your tooltip text"
tabindex="0">
Hover me
</button>
CSS Classes:
.tooltip - Base tooltip class (required).tooltip-[top|right|bottom|left] - Position (required).tooltip-[primary|success|warning|danger|info|light] - Color scheme (optional).tooltip-multiline - Allow text wrapping (optional).tooltip-[small|large] - Size variants (optional).tooltip-glow - Add glow effect (optional).tooltip-bounce - Add bounce animation (optional)