Either the full code you're using or a link to your page would allow us to help without the need for a crystal ball.
In the absence of that, have you tried margin: auto ?
When you use the value auto, you’re allowing the browser to calculate the margins for you automatically. In most cases, the calculated value will default either to zero or to the distance required to reach the parent element’s edge. In the case of a block element that has a specified width, left and right margins to which a value of auto is applied will be set to be equal. This will effectively center the element in the available space.