JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
    <div class="mybar"></div>
</div>

<div class="container two">
    <div class="mybar"></div>
</div>

CSS

* {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
.container {
    width: 30%;
    margin: auto;
    height: 25vh;
    border:1px solid green;
    margin-bottom: 10px;
}

.container.two {
    width: 60%;
}
.mybar {
    height: 50px;
    background: lightblue;
    position: relative;
}
.mybar::after {
    content:'';
    position: absolute;
    top:0;
    left: 50%;
    background: inherit;
    height: 100%;
    width: 50vw;
    z-index:-1
}