JSFiddle - React, Tailwind, and code Playground

HTML

<div class="centralizer popup">
    <div class="dragger"></div>
</div>

CSS

body {
    background:#ccc;
}
.centralizer {
    position:absolute;
    /*fixed works too*/
    top:150px;
    left:170px;
    width:352px;
    /*can be anything you want, even calc() */
    height:180px;
    /*can be anything you want, even calc() */
    overflow:auto;
    /*this puts scrollers if the content inside this element is bigger then the element itself, you can remove if you want */
    /*Here the magic begins*/
    -webkit-transform: translateY(-50%) translateX(-50%);
    -moz-transform: translateY(-50%) translateX(-50%);
    -ms-transform: translateY(-50%) translateX(-50%);
    transform: translateY(-50%) translateX(-50%);
}
.popup {
    background:white;
    box-shadow:0 0 0 2px rgba(0, 0, 0, 0.1), 0 0 15px rgba(0, 0, 0, 0.3);
    border-radius:3px;
}
.dragger {
    background:#eee;
    height:35px;
    border-radius:3px 3px 0 0;
    border-bottom:1px solid #ccc;
}

JavaScript

var popup = document.querySelector('.popup');
var rect = popup.getBoundingClientRect();

console.log("getBoundingClientRect(): \n" + "x: " + rect.left + "\ny: " + rect.top);
console.log("offset: \n" + "x: " + popup.offsetLeft + "\ny: " + popup.offsetTop);