Flexbox: How to stretch row’s elements to full width?

I have a flexbox grid of random width images with following properties:

.grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

.grid .grid-in {
    padding: 0;
    width: auto;
    height: 250px;

.grid .grid-in .grid-item {
    width: auto;
    display: inline-block;
    vertical-align: bottom;
    float: none;
    margin: 1px;
    overflow: hidden;

.grid .grid-in .grid-item img {
    max-width: 100%;
    width: 100%;
    height: auto;
    padding: 0;

which results in:

enter image description here

I would like to stretch elements of each row to full width – how can I achieve that with CSS?

Source: css

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.