Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div id="outer">bla
    <br>
    some height
    <div id="inner"></div>
  </div>
  <div id="results">
    outer height: <span></span><br>
    inner padding-top: <span></span>
  </div>
</body>
</html>
 
window.onresize = function() {
  document.getElementsByTagName('span')[0].innerHTML = document.getElementById('outer').offsetWidth;
  document.getElementsByTagName('span')[1].innerHTML = document.getElementById('inner').offsetHeight +2;
// +2 for the borders
}
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers