<style>.monitor {position:fixed;/* ... absolute possible if on :root */top:0;bottom:0;right:0;left:0;visibility:hidden;}.wrapper {width:200px;/* this is size range */height:100px;position:absolute;left:50%;top:50%;visibility:hidden;}
.content {position:absolute;width: 100%;height:100%;left:-50%;top:-50%;visibility:visible;}
</style>
<div class="monitor"><div class="wrapper"><div class="content">
... so you hav div 200px*100px on center ...
</div></div></div>
<head><style> body { color: red; margin: 5px } </style></head><body>
<script>let computedStyle = getComputedStyle(document.body);
// now we can read the margin and the color from it
alert( computedStyle.marginTop ); // 5pxalert( computedStyle.color ); // rgb(255, 0, 0)</script>
</body>
.box {width: 50px;height: 20px;background: red;}
.container {display: flex;justify-content: center;align-items: center;height: 100vh;width: 100vw;position: fixed; /* remove this in case there is no content under div (and remember to set body margins to 0)*/}