I just made my first CSS grid layout and I am impressed by the way the template area's work, but at this moment in time I am also massively confused about the way I am suppose to fill the template area's with items that in itself have responsive columns.
For example. My template area named content contains a article tag with 1 row and 2 columns with responsive Flexboxgrid/Bootstrapgrid behaviour. Like so:
<main class="g-content">
<article>
<div class="row">
<div class="col-xs-12 col-sm-6">
column left
</div>
<div class="col-xs-12 col-sm-6">
column right
</div>
</div>
</article>
</main>
And CSS, where g-content is just a grid-area:
<style>
.g-content {
grid-area: content;
}
</style>
I love the flexibility that these col- classes give, because they are in the html. So I add 2 classes in this case and the column behaves like I want it to.
So I'm not concerned with the overall template anymore, but I am concerned with the content blocks themselves... Now I throw out the idea of Flexboxgrid/Bootstrapgrid.
So, what would be a fast and flexible way to, in this case, create 2 responsive columns using CSS Grid, that behave differently on certain breakpoints?
Or isn't CSS Grid able to replace the Flexboxgrid/bootstrap responsive column system?
Update: I am considering rewriting the bootstrap column classes but on a CSS GRID way. Not sure if this is the ultimate solution, but it works.
@include screen('sm') {
.row-sm-4 {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
.row-sm-6 {
display: grid;
grid-template-columns: 1fr 1fr;
}
}
@include screen('md') {
.row-md-4 {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
}
Ofcourse the col- classes need to become row- classes because the grid is apply from the container.