I think the best way to center an element is to use flex-box. For example, we need to center a title in a beautiful home page.
The container parent of the item(s), must have the proporty/value, display: flex
Then there is many simple solutions to center your element:
Thanks to read this article, and I hope it will help some beginners like me.