Why isn't div centering?
Posted
by
user2898276
on Stack Overflow
See other posts from Stack Overflow
or by user2898276
Published on 2013-10-23T09:51:52Z
Indexed on
2013/10/23
9:53 UTC
Read the original article
Hit count: 109
I'm trying to centre a logo in the middle of the browser. I have this so far...
<script type="text/javascript">
$(document).ready(function(){
$(window).resize(function(){
$('#theLogo').css({
position:'absolute',
left: ($(window).width() - $('#theLogo').outerWidth())/2,
top: ($(window).height() - $('#theLogo').outerHeight())/2
});
});
$(window).resize();
});
HTML
<div id="theLogo">
<section id="responsiveLogo" class="logo">September</section>
</div>
I'm trying to centre this bit:
<section id="responsiveLogo" class="logo">September</section>
© Stack Overflow or respective owner