flex-wrap : add an additional class to even rows Hello,
How is it possible to add an additional class to even rowns if I use flex with flex wrap to display divs ?
Thanks for your help.
V
You need to specify the width for each element, otherwise you can't just control the number of elements for each row.
However, if you add to the elements flex-grow: 1; All rows are going to be filled. But you still with the first issue.
Is this what you're asking for?
@MohamedTammam I want to display hexagonal divs like a beehive. Even rows need a margin left to do that.
The problem is : how to add a class only to the divs that are in the even rows.
I also thought about doing this with a CSS grid, but I think that the problem is the same.
@Snapey Yes thank you ... but if I'm using CSS flex or CSS grid, I don't any divs to display the different rows, it's a unique div and the rows are created automatically.
Or perhaps I think too complicated and I don't think about something very simple ?
@vincent15000 perhaps you need a grid of a single row, followed by a grid of a single row
I cant see how a grid with multiple rows can be staggered left and right?
@Snapey The only way seems to handle the rows manually in a loop to display the divs.
Please sign in or create an account to participate in this conversation.