I am simply looking to move the 8 flex box items I have (name: products-box
) to 4 per row. Here is what I have so far:
<!DOCTYPE html>
<html lang="en">
<style type="text/css">
*{
box-sizing: border-box;
padding: 0;
margin: 0;
}
body{
min-height: 100vh;
}
header{
height: 80px;
display: flex;
background-color: lightblue;
}
.products-container{
width: 100%;
height: auto;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-evenly;
}
.products-box{
width: 200px;
height: 200px;
background-color: lightpink;
color: white;
font-size: 20px;
text-align: center;
line-height: 200px;
}
.main-container{
display: flex;
min-height: 100vh;
}
.nav-sidebar{
min-width: 150px;
background-color: lightgray;
}
.inner-text{
font-weight: 600;
font-size: 24px;
margin: auto;
}
</style>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<header>
<span class="inner-text">Header</span>
</header>
<div class="main-container">
<aside class="nav-sidebar" id="nav-container">
<span class="inner-text">Sidebar</span>
</aside>
<div class="products-container">
<div class="products-box">
Item1
</div>
<div class="products-box">
Item2
</div>
<div class="products-box">
Item3
</div>
<div class="products-box">
Item4
</div>
<div class="products-box">
Item5
</div>
<div class="products-box">
Item6
</div>
<div class="products-box">
Item7
</div>
<div class="products-box">
Item8
</div>
</div>
</div>
</body>
</html>
I am trying to get the flexbox labeled products-box
to be 4 per row, and be even if not.
New contributor
Thomas Eddington III is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.