JSFiddle - React, Tailwind, and code Playground
by Pedro Pinto
HTML
<div class="main_wrapper">
<section>
<div class="text"><h1>text</h1></div>
<div class="img"><h1>img</h1></div>
</section>
<section>
<div class="img"><h1>img</h1></div>
<div class="text"><h1>text</h1></div>
</section>
<section class="full">
<div class="text"><h1>text</h1></div>
<div class="img"><h1>img</h1></div>
</section>
</div>
CSS
* {
box-sizing: border-box;
}
.main_wrapper {
display: flex;
justify-content: center;
flex-wrap: wrap;
background: #123456;
}
section {
display: flex;
max-width: 500px;
width: 100%;
margin-right: 16px;
margin-left: 16px;
}
section > div {
width: 50%;
}
section > div.text {
background-color: red;
}
section > div.img {
background-color: yellow;
}
section.full {
max-width: 100%;
justify-content: flex-end;
margin-right: 0;
}
section.full .text {
max-width:250px;
}
section.full .img {
text-align: right;
}