I
I
Ivan Gordienko2021-03-29 22:42:19
css
Ivan Gordienko, 2021-03-29 22:42:19

How to create such a CSS Grid?

Good day to all!

60622d0e5f2ea444244815.png

There is a similar structure, but now it is all very crutch and bad.
It is required to make sure that there are a maximum of 6 elements in the first row, if less, then they are evenly spaced in width, and after 6 elements, each next one has the width of the entire container, there can be a lot of elements, the main thing is that each next after 6 should go full width. I have already tried it through grid-area with grid-template-areas, and even returned to flex already, please help me find a solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Litvinenko, 2021-03-29
@AntonLitvinenko

I would do it on flex. all cards flex-grow: 1;
and cards nth-child(n+7) have a width of 100%. and other styles
other styles can be specified by adding an extra class as well. when integrating in a cycle, start a counter and after the 6th iteration add a new class to items

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question