Centering can be difficult to figure out before you have developed a bit of experience and some tricks.
Adding a background color to your elements while you experiment often enables you to better understand the extent, position and consequences of changing the code.