<div class="container">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
</div>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f4;
}
.container {
display: flex;
flex-wrap: wrap;
align-content: space-between; /* Try values like 'flex-start', 'flex-end', 'center', 'space-around', 'stretch' */
width: 300px;
height: 300px;
border: 2px dashed #333;
background-color: #fff;
padding: 10px;
}
.item {
width: 80px;
height: 80px;
background-color: #61dafb;
margin: 5px;
display: flex;
justify-content: center;
align-items: center;
font-size: 20px;
color: white;
font-weight: bold;
border-radius: 5px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.