Is there a way to horizontally center a grid of images created with flex while still keeping the images left-aligned on each row? I want this layout to adjust dynamically based on the number of elements per row.
Check out my Jsfiddle attempt here
.gallery {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-content: flex-start;
align-items: flex-start;
}
.gallery-artwork {
width: 400px;
display: flex;
margin: 10px;
}
<div class="gallery">
<div class="gallery-artwork">
<img src="http://placehold.it/400x225">
</div>
<div class="gallery-artwork">
<img src="http://placehold.it/400x225">
</div>
<div class="gallery-artwork">
<img src="http://placehold.it/400x225">
</div>
<div class="gallery-artwork">
<img src="http://placehold.it/400x225">
</div>
<div class="gallery-artwork">
<img src="http://placehold.it/400x225">
</div>
</div>