JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="position"></div>
<div class="float">
<div class="float-inner"></div>
</div>
</div>
CSS
.container{
width: 100%;
height: 300px;
background: #eee;
margin: 0 auto;
position: relative;
}
.position{ /* Элемент с позиционированием */
width: 100px;
height: 50px;
background: #0c2;
position: absolute;
top: 10px;
left: 50%;
margin-left: -50px; /* Отступ на половину ширины */
}
.float{ /* Плавающий элемент */
width: 100%;
float: left;
margin: 100px 0 0 -100px; /* Отступ на половину ширины элемента .float-inner */
}
.float-inner{
width: 200px;
background: #c02;
height: 50px;
margin-left: 50%;
}
.container:after{ /* clearfix */
content: "";
display: block;
clear: both;
}