L
L
lavezzi12015-11-08 16:34:54
css
lavezzi1, 2015-11-08 16:34:54

Last blocks in flexbox grid stretch, how to prevent?

Hello! There is a fixed width container. There are blocks, flex-flow: row wrap. In short, mesh. But if, let's say, two blocks, or even worse, one wraps onto a new line, this is usually the last one. I think this is due to the fact that I have the flex: auto property applied to the blocks. Is there a way to set the maximum width? So that the grid is rubbery, but at the same time the blocks do not spread over the entire page? Thanks
Live example: jsfiddle.net/w7Lw0pc4 Needed
: for blocks to have a maximum width, stretch (fill the container) to the maximum width if needed. And so that the last blocks do not stretch as in the example. Maybe?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pupkin, 2015-11-08
@sakrab

.item {
    flex-wrap: auto;
    width: 200px;
    height: 200px;
    background: #ddd;
    margin: 5px;
}

In my opinion it would be better:
.item {
    flex-wrap: wrap ;
    width: 200px;
    height: 200px;
    background: #ddd;
    margin: 5px;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question