I have a div that appears once I have clicked some action to another element in the website. It is a fixed div that appears on top of all divs and
You can set top, right, bottom, left to 0 and margin to auto to vertically and horizontally center align fixed div. But this will only work if you set the height of div using CSS.
.overlay-box {
background-color: #fff;
border: 1px solid #000;
text-align:center;
height: 200px;/*height needs to be set*/
width: 550px;
margin: auto;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
If you can't set the height then consider using flex layout https://css-tricks.com/snippets/css/a-guide-to-flexbox/