The code below lays focus on middle div but that div appears at the bottom of the window. How can I center that div so it appears in the center of window [vertically] without setting position fixed.
$(function(){
$("#focus").focus().addClass('getCentered');;
setTimeout(function() {
$('#focus').css("background-color", "white");
}, 1000);
});
.top{background:red;height:400px;width:2oopx}
#focus{background:#ededed;height:40px;width:2oopx}
.bottom{background:green;height:300px;width:2oopx}
The code below focuses on the middle `div` but the div focused is shown at the bottom of the page. How can I center that div so that it is shown at center of page[vertically] without setting position fixed.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="top">hello</div>
<div id="focus" tabindex="1">Hello world</div>
<div class="bottom">world</div>
fixed.