JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="size1">1</div>
<div class="size2">2</div>
<div class="size3">3</div>
<div class="size1">4</div>
<div class="size1">5</div>
<div class="size4">6</div>
</div>
CSS
div {
box-sizing: border-box;
}
div.container {
padding: 20px;
background: #ddd;
width: 600px;
border: 2px solid #aaa
}
div.container > div {
display: inline-block;
width: 26%;
background: #4679bd;
vertical-align: top;
margin: 3%;
/* identifiers */
text-align: center;
font-size: 1.2em;
color: white;
border: 1px solid #333;
}
div.size1 {
height: 120px;
}
div.size2 {
height: 200px;
}
div.size3 {
height: 50px;
}
div.size4 {
height: 170px;
}
JavaScript
// Why won't boxes 4 and 6 position themselves under boxes 1 and 3 respectively with just the margin separating them?