In this article, you will learn How to Create Tooltip using CSS.
Example:-
<html>
<head>
<title>Tooltip using CSS</title>
<style>
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
bottom: 100%;
left: 50%;
margin-left: -60px;
opacity: 0;
transition: opacity 1s;
}
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
</style>
</head>
<body style="text-align:center;">
<h2>Tooltip on Hover</h2>
<p>When move the mouse over the text, the tooltip text will fade in.</p>
<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text here</span>
</div>
</body>
</html>