Hover with psuedo element

by Matthew Day

HTML

<div class="square one"></div>
<div class="square two"></div>

CSS

.square {
    display: inline-block;
    width: 40px;
    height: 40px;
    margin: 0 10px;
}

.one {
    border: 1px solid black;
}

.two {
    background: black;
}

.square::after {
    display: block;
    opacity: 0;
    content: '';
    width: 12px;
    height: 12px;
    background: red;
    border-radius: 6px;
    margin: 50px auto 0 auto;
    transition: all 1s ease-in-out;
}

.square:hover::after {
    opacity: 1;
}