/* Tooltip container */
.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}

/* Tooltip text */
.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: yellow;
    color: #fff;
    text-align: center;
    padding: 5px 0;
    border-radius: 6px;
 
    /* Position the tooltip text - see examples below! */
    position: absolute;
    z-index: 1;
}

/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
    visibility: visible;
}

/* position */

.tooltip .tooltiptext.tooltip-top {
    width: 120px;
    bottom: 100%;
    left: 50%;
    margin-left: -60px; /* Use half of the width (120/2 = 60), to center the tooltip */
} 
.tooltip .tooltiptext.tooltip-right {
    top: -5px;
    left: 105%;
} 
.tooltip .tooltiptext.tooltip-bottom {
    width: 120px;
    top: 100%;
    left: 50%;
    margin-left: -60px; /* Use half of the width (120/2 = 60), to center the tooltip */
} 
.tooltip .tooltiptext.tooltip-left {
    top: -5px;
    right: 105%;
} 

/* triangles */

.tooltip .tooltiptext.tooltip-top::after {
    content: " ";
    position: absolute;
    top: 100%; /* At the bottom of the tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: yellow transparent transparent transparent;
} 
.tooltip .tooltiptext.tooltip-right ::after {
    content: " ";
    position: absolute;
    top: 50%;
    right: 100%; /* To the left of the tooltip */
    margin-top: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent yellow transparent transparent;
} 
.tooltip .tooltiptext.tooltip-bottom::after {
    content: " ";
    position: absolute;
    bottom: 100%;  /* At the top of the tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent yellow transparent;
} 
.tooltip .tooltiptext.tooltip-left::after {
    content: " ";
    position: absolute;
    top: 50%;
    left: 100%; /* To the right of the tooltip */
    margin-top: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent transparent yellow;
} 

/* animation */

.tooltip  .tooltiptext {
    opacity: 0;
    transition: opacity 0.5s;
}

.tooltip, .tooltip:hover .tooltiptext {
    opacity: 1;
}
