<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/assets/reset.css" rel="stylesheet">
<link href="setup.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
</head>
<body>
<ol>
<li>
<p>Item 1</p>
</li>
<li>
<p>Item 2 with <br>a line break</p>
</li>
<li>
<p>Item 3</p>
</li>
<li>
<p>Item 4</p>
</li>
</ol>
<ol>
<li>
<p>Item 1</p>
</li>
<li>
<p>Item 2 with <br>a line break</p>
</li>
<li>
<p>Item 3</p>
</li>
<li>
<p>Item 4</p>
</li>
</ol>
<ol>
<li>
<p>Item 1</p>
</li>
<li>
<p>Item 2 with <br>a line break</p>
</li>
<li>
<p>Item 3</p>
</li>
<li>
<p>Item 4</p>
</li>
</ol>
<ol>
<li>
<p>Item 1</p>
</li>
<li>
<p>Item 2 with <br>a line break</p>
</li>
<li>
<p>Item 3</p>
</li>
<li>
<p>Item 4</p>
</li>
</ol>
<ol>
<li>
<p>Item 1</p>
</li>
<li>
<p>Item 2 with <br>a line break</p>
</li>
<li>
<p>Item 3</p>
</li>
<li>
<p>Item 4</p>
</li>
</ol>
<ol>
<li>
<p>Item 1</p>
</li>
<li>
<p>Item 2 with <br>a line break</p>
</li>
<li>
<p>Item 3</p>
</li>
<li>
<p>Item 4</p>
</li>
</ol>
<ol>
<li>
<p>Item 1</p>
</li>
<li>
<p>Item 2 with <br>a line break</p>
</li>
<li>
<p>Item 3</p>
</li>
<li>
<p>Item 4</p>
</li>
</ol>
</body>
</html>
index.html
body {
font-family: sans-serif;
padding: 1rem;
}
ol { background-color: gold; }
ol:not(:first-child) { margin-block-start: 1rem; }
li {
background-color: tomato;
border-block-end: 0.1rem solid firebrick;
border-inline-end: 0.1rem solid firebrick;
padding: 0.5rem;
}
setup.css
ol {
block-size: 9rem;
display: flex;
flex-wrap: wrap;
}
li { inline-size: 9rem; } /* So they wrap. */
ol:nth-child(1) { align-content: stretch; } /* Default. */
ol:nth-child(2) { align-content: start; }
ol:nth-child(3) { align-content: center; }
ol:nth-child(4) { align-content: end; }
ol:nth-child(5) { align-content: space-between; }
ol:nth-child(6) { align-content: space-around; }
ol:nth-child(7) { align-content: space-evenly; }
ol:nth-child(5) { background: orange } /* Just for easier counting. */
style.css