JSFiddle - React, Tailwind, and code Playground

HTML

<div class="PARENT">
<div class="RED">RED</div>
<div class="BLUE">BLUE</div>
<div class="GREEN">GREEN</div>   
</div>

CSS

.PARENT{
    position: relative;
}

.RED{
    display: inline-block;
    margin: 5px;
    padding: 5px;
    color: #BB0000;
    background: #FFF;
}

.RED:hover:after{
    display: block;
    width: 100%;
    height: 100%;
    background: #BB0000;
    position: absolute;
    top: 0px;
    left: 0px;
    content: ' ';
    z-index: -1;
}

.BLUE{
    display: inline-block;
    margin: 5px;
    padding: 5px;
    color: #0000BB;
    background: #FFF;
}
.BLUE:hover:after{
    display: block;
    width: 100%;
    height: 100%;
    background: #0000BB;
    position: absolute;
    top: 0px;
    left: 0px;
    content: ' ';
    z-index: -1;
}
.GREEN{
    display: inline-block;
    margin: 5px;
    padding: 5px;
    color: #00BB00;
    background: #FFF;
}
.GREEN:hover:after{
    display: block;
    width: 100%;
    height: 100%;
    background: #00BB00;
    position: absolute;
    top: 0px;
    left: 0px;
    content: ' ';
    z-index: -1;
}