- style.css
- setup.css
- index.html
/* Setup styles in the other file. */
section {
display: flex;
}
section:nth-child(1) {
/* This is the default. */
justify-content: flex-start;
}
section:nth-child(2) {
justify-content: center;
}
section:nth-child(3) {
justify-content: flex-end;
}
section:nth-child(4) {
justify-content: space-between;
}
section:nth-child(5) {
justify-content: space-around;
}
section:nth-child(6) {
justify-content: space-evenly;
}
body {
font-family: sans-serif;
padding: 20px;
}
div {
background-color: tomato;
border-bottom: 2px solid firebrick;
border-right: 2px solid firebrick;
padding: 5px;
}
section {
background-color: gold;
height: 100px;
}
section:not(:first-child) {
margin-top: 20px;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<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>
<section>
<div>
<p>Item 1</p>
</div>
<div>
<p>Item 2</p>
</div>
<div>
<p>Item 3</p>
</div>
</section>
<section>
<div>
<p>Item 1</p>
</div>
<div>
<p>Item 2</p>
</div>
<div>
<p>Item 3</p>
</div>
</section>
<section>
<div>
<p>Item 1</p>
</div>
<div>
<p>Item 2</p>
</div>
<div>
<p>Item 3</p>
</div>
</section>
<section>
<div>
<p>Item 1</p>
</div>
<div>
<p>Item 2</p>
</div>
<div>
<p>Item 3</p>
</div>
</section>
<section>
<div>
<p>Item 1</p>
</div>
<div>
<p>Item 2</p>
</div>
<div>
<p>Item 3</p>
</div>
</section>
<section>
<div>
<p>Item 1</p>
</div>
<div>
<p>Item 2</p>
</div>
<div>
<p>Item 3</p>
</div>
</section>
</body>
</html>