JSFiddle - React, Tailwind, and code Playground
HTML
<div id="ev-entry" class="ex_event_frame">Testing if the height element is positioned at the center of the screen regardless of the resolution used</div>
CSS
.ex_event_frame {
left: 39px;
margin-left: auto;
margin-right: auto;
width: 300px;
height: 300px;
overflow: auto;
background: #2e3030;
color: #ffffff;
position: absolute;
z-index: 101;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 14px;
-moz-box-shadow: 0 0 10px rgba(0, 0, 0, .4);
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, .4);
-box-shadow: 0 0 10px rgba(0, 0, 0, .4);
border: 8px solid #105f6b;
}
JavaScript
$(function () {
$(window).resize(function(){
var offset = 0,
viewportHeight = $(window).height(),
$myDialog = $('#ev-entry');
console.log(viewportHeight + " "+$myDialog.height() )
$myDialog.css('top', (offset + (viewportHeight / 2)) - ($myDialog.height() / 2));
}).resize();
});