<div class="box row">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div class="box column">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div class="clear"></div>
<div class="note row">
<pre><code>grid-auto-flow: <strong>row</strong>;</code></pre>
</div>
<div class="note column">
<pre><code>grid-auto-flow: <strong>column</strong>;</code></pre>
</div>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.box {
width: 50%;
padding: 6px;
display: grid;
height: 175px;
grid-auto-flow: row;
grid-gap: 2px;
float: left;
}
.box.column {
grid-auto-flow: column;
float: right;
}
.box > div {
background-color: tomato;
}
.clear {
clear: both;
}
.note {
width: 50%;
font-size: 18px;
font-family: monospace;
text-align: center;
line-height: 5;
}
.note.row {
float: left;
}
.note.column {
float: right;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.