JSFiddle - React, Tailwind, and code Playground

by YangHax

HTML

<div id="outer">
    <div id="bar1"><span>30%</span></div>
    <div id="bar2"><span class="onright">80%</span></div>
</div>

CSS

#outer {
    border: 2px solid black;
    padding: 20px;
}

#bar1 {
    background-color: gray;
    width: 30%;
    height: 20px;
}

#bar2 {
    background-color: black;
    width: 80%;
    height: 20px;
    margin-top: 5px;
    position: relative;
}

span {
    display: block;
    color: white;
    text-align: right;
}

span.onright {
    color: black;
    position: absolute;
    right: -35px;
}