title: Getting the height of an element before added to the DOM
body: <p>Is there any way to get an element's height prior to appending it to the DOM? I know that clientHeight doesn't work as I've tried and it always returns 0. Are there other methods that may return the height or does the element have to be a part of the DOM in order for the height to be calculated?</p>
  
  <p>This is a sample of what I'm going for:</p>
  
  <pre><code>function test(a) {
      var a=document.createElement(a)
      a.style.top=(window.innerHeight/2-a.clientHeight/2)+'px' //fixed position in CSS
      document.body.appendChild(a)
      }
  </code></pre>
  
  <p>*Note: This is only a simplified version of the function I'm working on in order to project what I'm trying to achieve without all of the unneeded mess.</p>