Try flexbox settings on live boxes and copy the CSS.
flex-direction sets the main line: row runs left to right, column runs top to bottom, and the reverse versions flip the order. justify-content spreads items along that line: packed at the start, centred, at the end, or with space between, around or evenly. align-items lines them up across the line: stretched to fill, at the start, centre or end, or by their text baseline. The preview boxes have different heights so you can see align-items working.
flex-wrap: wrap lets items move onto a new line when they run out of room instead of squeezing. Add more preview boxes to see it.
To centre anything inside a container, use display: flex with justify-content: center and align-items: center. For vertical centring the container needs a height, for example min-height: 100vh for a full screen.
On the parent, set display: flex, justify-content: center and align-items: center, and give it a height.
justify-content works along the flex direction; align-items works across it. Switching to column swaps which is horizontal.
space-evenly makes every gap equal, including the edges. space-around gives the edges half-size gaps.
Yes, in all current browsers.
OneClickly is a set of 119 free tools for PDFs, images, text, everyday math and code. They run in your browser, so the files and text you work with stay on your device.