.parent {
display: grid;
place-items: center;
}
This will center things vertically and horizontally in the parent element. Super simple.
Here we are looking at the flex directive flex: Deconxtructed Pancake
.parent {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.box [
flex: 1 1 150px; /* stretching*/
flex: 0 1 150px; /* not stretching */
]