JSFiddle - React, Tailwind, and code Playground

by Mukul kant

HTML

<div class="windowMiddle box">
	
</div>

CSS

.windowMiddle{height: 200px;width: 300px;background: #ccc;position: fixed;}

JavaScript

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
		$(document).ready(function(){
		windowMiddle();
			$(window).resize(function(){
				windowMiddle();
			});
		});		
		function windowMiddle(){
			$('.windowMiddle').css({'left' : ($(window).width()-$('.box').width())/2});
			$('.windowMiddle').css({'top' : ($(window).height()-$('.box').height())/2});
		}