W3.CSS — Tooltips
Basic Tooltip
<div class="w3-tooltip">
Hover over me
<span class="w3-text">Tooltip text</span>
</div>
Tooltip Styles
<!-- Default tooltip -->
<div class="w3-tooltip">
Hover over me
<span class="w3-text">Default tooltip</span>
</div>
<!-- Tooltip with background -->
<div class="w3-tooltip">
Hover over me
<span class="w3-text w3-padding w3-green w3-round">Styled tooltip</span>
</div>
<!-- Tooltip on button -->
<button class="w3-button w3-blue w3-tooltip">
Button
<span class="w3-text">Click me!</span>
</button>
Tooltip Positions
<!-- Top tooltip (default) -->
<div class="w3-tooltip">
Top Tooltip
<span class="w3-text">Tooltip on top</span>
</div>
Tooltip Examples
<!-- Tooltip on link -->
<a href="#" class="w3-tooltip">
Link
<span class="w3-text w3-padding w3-blue w3-round">Go to page</span>
</a>
<!-- Tooltip on icon -->
<i class="fa fa-info-circle w3-tooltip">
<span class="w3-text w3-padding w3-black w3-round">Information</span>
</i>
<!-- Tooltip with rich content -->
<div class="w3-tooltip">
<span class="w3-button w3-green">Hover for details</span>
<div class="w3-text w3-padding w3-card-4" style="width:200px">
<h4>Details</h4>
<p>This tooltip contains rich content.</p>
</div>
</div>
Tooltip on Images
<div class="w3-tooltip">
<img src="image.jpg" alt="Image" style="width:100px">
<span class="w3-text w3-padding w3-black w3-round">Image description</span>
</div>
Mini Practice
Create HTML code that:
- Creates a basic tooltip
- Adds a tooltip on a button
- Creates a tooltip with styled background
- Uses tooltip on an image
Up Next
Next: Learn about W3.CSS Accordions.
Related Topics
Frequently Asked Questions about Tooltips
What is Tooltips in W3.CSS?
Tooltips is a fundamental concept in W3.CSS. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Tooltips?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Tooltips.
Why is Tooltips important in W3.CSS?
Tooltips is essential for W3.CSS development. Understanding this concept will help you write better code and solve real-world problems more effectively.