JSFiddle - React, Tailwind, and code Playground

by HappyCougar

HTML

<div class="mess_box">
    <p></p>
    <p class="close_butt_mes">Закрыть</p>
</div>

CSS

.mess_box {
    position:fixed;
    box-shadow: 0px 0px 20px #000;
    margin:0 auto;
    height:160px;
    width:240px;
    background:white;
}
body {
    background:gray;
}
.close_butt_mes {
    width: 140px;
    height: 30px;
    background: rgb(236, 202, 22);
    border: 1px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    color: rgb(255, 255, 255);
    cursor: pointer;
    margin: 0 auto;
    vertical-align: bottom;
    text-align: center;
    padding-top: 10px;
    position:relative;
    top:90px;
}

JavaScript

var wr = ($(window).width() - 240) / 2;
var hr = ($(window).height() - 160) / 2;
$('.mess_box').css('top', hr );
$('.mess_box').css('left', wr );