Answer the question
In order to leave comments, you need to log in
When working with flexbox, what is the correct way to create a standard grid?
Let's say this code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Швейный кластер</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="main">
<div class="header"></div>
<div class="content">
<div class="inner-content"></div>
<div class="inner-sidebar"></div>
</div>
<div class="footer"></div>
</div>
</body>
</html>
<body>
<div class="wrapper">
<div class="header">
<div class="inner-header"></div>
</div>
<div class="row">
<div class="content">
<div class="inner-content"></div>
</div>
<div class="sidebar">
<div class="inner-sidebar"></div>
</div>
</div>
<div class="footer">
<div class="inner-footer"></div>
</div>
</div>
</body>
Answer the question
In order to leave comments, you need to log in
The grid can be taken from bootstrap4, there is an excellent grid on flex
Well, usually it's better to do a site wrapper block, then from the header, footer, etc. Of course you can make containers. You don’t need to do a bunch of blocks, flex is much easier than float, it’s better to watch a couple of videos on YouTube, where they basically talk about flex and you’ll understand everything, so I explained it in a nutshell as best I can
No additional wrappers are needed. Set the parent to display: flex and all of its children will be aligned to the flex grid. From your 1st example it is
.main {
display: flex;
flex-flow: column nowrap;
justify-content: flex-start;
}
.header, .content, .footer { width: 100%; }
Then we make the main content
.content {
display: flex;
flex-flow: row nowrap;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question