Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <script>
    window.onresize = function(){
       getToMiddle();
    }
    window.onload = function(){
      getToMiddle();
    }
    
    function getToMiddle(){
  var box = document.getElementById('parent');
  var height = box.offsetHeight;
    var width = box.offsetWidth;
  box.style.marginTop = -(height/2);
    box.style.marginLeft = -(width/2);
    }
  </script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div id="parent">
   <div id="child">blahblah</div>
</div>
  
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers