I have this layout:
Basically the HTML and CSS is the following:
<style>
section { display: grid, grid-template-columns: repeat(3, 1fr) };
div::first-child: { grid-column: 1/3}
</style>
<section>
<div>...</div>
<div>...</div>
<div>...</div>
<div>...</div>
<div>...</div>
</section>
when the viewport becomes smaller, I want the grid to have 2 columns and then 1 column. I could use media-queries and redefine the number of columns but I'm wondering if there's an easy way to do that using auto-fill
function?
This answer shows how to do it by defining the width of the columns, but ideally I wouldn't want to do that and have the width based on the available space for the number of columns.