Centering in CSS
How many times when building a website have you tried to center an element within another element and it hasn’t worked? Is it a block level element? Do you know the height of the item? Are there lots of elements in lots of parents that all differ in height? This was the problem I had here: www.trinitypr.co.uk/clients/ – logos of different widths and heights. Turns out I could use display: flex – other times you might be able to use display: table-cell; vertical-align: middle
Try https://css-tricks.com/centering-css-complete-guide/ – it has all sorts of possibilities depending on your needs.