title: How to set css property that are inside a tag
body: <p>I can set all property in my entire html using:</p>
  <pre><code>document.getElementsByTagName('html')[0].style.setProperty(--color-dustomized, &quot;red&quot;);
  </code></pre>
  <p>But I just wanted to change the tags that are INSIDE the div with id class2, I tried something like this, but the error appears <code>Property 'style' does not exist on type 'Element'</code></p>
  <pre><code>document.getElementsByTagName('html')[0].getElementsByClassName('class2')[0].style.setProperty(--color-dustomized, &quot;red&quot;); // Property 'style' does not exist on type 'Element'.
  </code></pre>
  <p>I can't use it this way as I don't know how many <code>div</code> will be on the page:</p>
  <pre><code>document.getElementsByTagName('html')[0].getElementsByTagName('div')[1]
  </code></pre>
  <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>document.getElementsByTagName('html')[0].getElementsByClassName('class2')[0].style.setProperty(--color-dustomized, "red");</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="class1" class="class1"&gt;
    &lt;!-- code --&gt;
  &lt;/div&gt;
  
  &lt;div id="class2" class="class2"&gt;
    &lt;!-- code --&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>