title: Cross-browser (IE8-) getComputedStyle with Javascript?
body: <p>Since <strong>IE8</strong> does not support <code>getComputedStyle</code>, we can only use <code>currentStyle</code>. However, it does not return the real "computed" value for some properties.</p>
  
  <p>For example:</p>
  
  <pre class="lang-css prettyprint-override"><code>&lt;style type="text/css"&gt;
  #div {/* no properties are defined here */}
  &lt;/style&gt;
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div id="div"&gt;div&lt;/div&gt;
  </code></pre>
  
  <pre class="lang-javascript prettyprint-override"><code>// returns "medium" instead of 0px
  document.getElementById('div').currentStyle.borderLeftWidth
  
  // returns "auto" instead of 0px
  document.getElementById('div').currentStyle.marginLeft
  
  // returns "undefined" instead of 1
  document.getElementById('div').currentStyle.opacity
  </code></pre>
  
  <p>Does anyone have a cross-browser solution for all properties without using jQuery or other Javascript libraries?</p>