JSFiddle - React, Tailwind, and code Playground
by avrahamcool
HTML
<div id="Container">
<h2 id="Goal"><span class="Filler"></span><span class="Text">Goal</span></h2>
<div id="WhiteBlock"></div>
<div id="GreenBlock"></div>
<h2 id="SoFar"><span class="Filler"></span><span class="Text">So Far</span></h2>
</div>
CSS
*
{
padding: 0;
margin: 0;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
}
#Container
{
margin: 20px auto;
width: 150px;
height: 250px;
border: 1px solid black;
position: relative;
}
#WhiteBlock
{
height: 70px;
border-bottom: 1px solid black;
}
#GreenBlock
{
height: calc(100% - 70px);
background-color: #17ff80;
position: relative;
z-index: 500;
}
h2
{
width: 35%;
left: 32.5%;
position: absolute;
text-align: center;
}
h2 > .Filler
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: white;
z-index: 100;
}
h2 > .Text
{
position: relative;
z-index: 1000;
}
#Goal
{
top: -0.7em;
}
#SoFar
{
top: calc(70px - 0.7em);
}