JSFiddle - React, Tailwind, and code Playground

by iurevych

HTML

<div class="holder">
    Heyo! Hover on me and I'll show you a popup
    <div class="popup">Hi there!</div>
</div>

SCSS

.holder {
    cursor: pointer;
    display: inline-block;
    padding: 10px;
    position: relative;
    
    &:hover {
        .popup {
            opacity: 1;
            top: 100%;
            visibility: visible;
            z-index: 1;
            
            &:before {
                top: -7px;
            }
        }
    }
}

.popup {
    background-color: #333;
    color: #fff;
    cursor: default;
    font-size: 12px;
    left: 50%;
    margin-left: -50px;
    opacity: 0;
    padding: 10px 15px;
    position: absolute;
    text-align: center;
    top: 80%;
    transition: visibility .3s, top .3s, opacity .3s;
    visibility: hidden;
    width: 70px;
    
    &:before {
        border-color: transparent transparent #333 transparent;
        border-style: solid;
        border-width: 0 7px 7px 7px;
        content: "";
        height: 0;
        left: 50%;
        margin-left: -7px;
        position: absolute;
        transition: top .2s;
        top: 0;
        width: 0;
    }
}