I don't see your code, so I cannot comment specifically on your solution, but it is the easiest to center things using flexbox. You give a min-height to the container, so that it is higher than the content, and then you can center horizontally (supposing you kept the default arrangement, which is flex-direction: row) with justify-content: center and vertically using align-items: center. You have everything right in the middle.
Another solution, but a little bit hacky, and far more complicated than flexbox, would be absolute positioning either combined with transform: translate() or using calc() have the element right in the center. But nothing is easier than using flexbox.
Marked as helpful