// you dont need to know the divs dimensions and it does not require any container divsposition: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
To horizontally center a block element (like <div>), use margin: auto;
Setting the width of the element will prevent it from stretching outto the edges of its container.
The element will then take up the specified width, and the remaining space will be split equally between the two margins