- Home
- /
- CSS ToolTip Text
CSS Tutorial
Introduction
CSS Properties
CSS Designing
CSS Advance Topics
CSS FAQs
- Home
- /
- CSS ToolTip Text
CSS Tooltip Text
A tooltip is a small hover box that appears when the user moves their mouse over an element. It’s commonly used to provide additional information, hints, or labels without cluttering the UI.
Tooltips improve accessibility and user understanding, especially on buttons, icons, or labels that need brief explanations.
How Tooltips Work
In CSS, we typically use a combination of:
A wrapper element (e.g., a
<span>
or<div>
)A hidden
<span>
or pseudo-element that acts as the tooltipVisibility toggled on
:hover
Example:
CSS Tooltip – Learn With Arshyan
CSS Tooltip Example – Learn With Arshyan
Hover over this
keyword
This is a helpful tooltip text.
to see the tooltip.

What Each Value Means:
The
.tooltip-container
wraps the element you want to apply the tooltip to.The
.tooltip-text
is hidden by default (visibility: hidden; opacity: 0
).On hover, CSS makes it visible and fades it in smoothly using a transition.
It appears above the element using
bottom: 125%
and is centered horizontally.
Enhancing Tooltips
You can customize tooltips further:
Add
transition-delay
for delayed appearanceUse
::after
pseudo-elements for minimal HTMLChange position to the right, left, or below
Add arrow using
::after
with CSS borders
Summary Table
Feature | Behavior |
---|---|
Tooltip trigger | On hover |
Tooltip text | Hidden by default |
Show effect | Controlled by :hover and transition |
Use cases | Hints, labels, helper notes |
Learn With Arshyan Tip:
Tooltips should be short and useful. Avoid showing too much information—keep them focused and readable even on small screens.