Create tooltips with CSS

CSSWeb DevelopmentFront End Technology

A tooltip is visible when a user moves the mouse cursor on a text. You can add information in it to make it easy for users to understand.


You can try to run the following code to learn how to create tooltip −

Live Demo

<!DOCTYPE html>
      #mytooltip #mytext {
         visibility: hidden;
         width: 100px;
         background-color: black;
         color: #fff;
         text-align: center;
         border-radius: 3px;
         padding: 10px 0;
         position: absolute;
         z-index: 1;
      #mytooltip:hover #mytext {
         visibility: visible;
      <div id = "mytooltip">Hover the mouse over me
         <p id = "mytext">My Tooltip text</p>
Updated on 02-Jul-2020 10:58:25