JSFiddle - React, Tailwind, and code Playground
by stupid_genius
HTML
<div id="main">
<div id="centered">
<div id="center"><---X---></div>
<div id="left">Left</div>
<div id="right">Right</div>
</div>
</div>
CSS
html, body {
margin: 0;
padding: 0;
}
#main {
position: absolute;
width: 100%;
height: 100%;
background: lightblue;
}
#centered {
position: relative;
margin: 0 auto;
width: 500px;
background: yellow;
}
#center {
margin: 0 auto;
width: 100px;
text-align: center;
background: gray;
}
#left,
#right {
position: absolute;
top: 0;
}
#left {
/* right: calc(50% + 50px); */
left: 0;
width: 50px;
background-color: green;
}
#right {
/* left: calc(50% + 50px); */
right: 0;
width: 200px;
background-color: red;
}