title: javascript set style width 80%?
body: <p>I want to set the width of my object to 80%. The parent div width is 100%</p>
  
  <p>whats wrong?</p>
  
  <pre><code>var howManyDivsIHave = document.querySelectorAll('#section div.divs').length;
  if(howManyDivsIHave == "1"){
      var divs = document.getElementById("section").getElementsByClassName("divs");
      divs.style.width = "80%"; 
      divs.style.height = "80%";
      divs.style.margin = "10%";
  }
  else if (howManyDivsIHave == "2"){
      divs.style.width = "40%"; 
      divs.style.height = "40%";
      divs.style.margin-top = "30%";
      divs.style.margin-bottom = "30%";
      divs.style.margin-left = "5%";
      divs.style.margin-right = "5%"; 
  }
  else if (howManyDivsIHave == "3"){
      divs.style.width = "40%"; 
      divs.style.height = "40%";
      divs.style.margin = "5%";
  }
  </code></pre>
  
  <p>}</p>