I am trying to use Angular flex-layout create a grid of images that is left justified, but I want the whole grid to be centered on the screen. The problem is that I can only center it row by row, which makes the the last one not left justified. I think I need a way to get the container to shrink to the size of the content but display: inline-block
is not doing it.
See images:
Left justified, but not centered on the screen aka fxLayoutAlign="start center"
Centered on the screen, but not left justified aka fxLayoutAlign="center center"
Here is my code:
* {
border: 1px solid black;
}
.gallery {
display: inline-block;
}
.tile{
background-color: red;
width: 100px;
height: 100px;
margin: 10px;
}
<div class="gallery" fxLayout="row wrap" fxLayoutAlign="start center">
<div class='tile' *ngFor="let number of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]"> </div>
</div>