title: CSS style outputting empty string in JavaScript
body: <p>I'm trying to get the <code>padding</code> value of an element in JavaScript. Here's how:</p>
  
  <pre><code>var textWrapper = document.getElementById('textWrapper');
  console.log(textWrapper.children[0].style.padding);
  </code></pre>
  
  <p>It outputs an empty string, even though in the css style, the <code>padding</code> is set to <code>10px</code>. What am I doing wrong, and how can I fix it?</p>
  
  <p><a href="https://jsfiddle.net/ydnesrcu/" rel="nofollow"><h3>JSFiddle</h3></a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>console.clear()
  
  var textWrapper = document.getElementById('textWrapper');
  console.log(textWrapper.children[0].style.padding);</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.text {
    width: 200px;
    height: 50px;
    padding: 10px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="textWrapper"&gt;
    &lt;div class="text"&gt;"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do&lt;/div&gt;
    &lt;div class="text"&gt;Duis aute irure dolor in reprehenderit&lt;/div&gt;
    &lt;div class="text"&gt;Excepteur sint occaecat cupidatat non&lt;/div&gt;
    &lt;div class="text"&gt;"Sed ut perspiciatis unde omnis iste natus error sit&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>