Is there a way, without using media query, to limit the number of columns that get created, and combine that with auto-fit/fill?
For example:
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
Creates a wonderful, responsive layout. But imagine the design calls for a maximum of 3 columns -- even in wide browsers. It would happily show, 4, 5, more columns as space allows.
Using media query, I could specify big screens get:
grid-template-columns: 1fr 1fr 1fr;
And smaller screens get:
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
But that feels wrong. Is there a way to tell my grid layout to repeat up to a maximum of n times, and still use repeat and auto-fit/fill?
Update: This is not a duplicate of: How to limit the amount of columns in larger viewports with CSS Grid and auto-fill/fit?
I am asking how to make the code for the viewport also work for smaller viewports. The question (and answer) referenced above only gets to the starting point of my question.