How do I force a break after a div via CSS?
What are the ways I can do it? Normal box model, Inline, flex, float?
by jshacker
HTML
<div class="grid">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
CSS
.cell {
height: 50px;
width: 50px;
background-color: #999;
display: inline-block;
}
.cell:nth-child(3n) {
background-color: #f00;
/* what property should I use to get a line break after this element? */
}
.cell:nth-child(3n)::after {
display: inline;
content: "\A";
white-space: pre;
}