Javascript - add css style to element with class
<p>I want to add only one css style in JS. I don't want to include jQuery for only one thing.</p>

<p>My code:</p>

<pre><code>document.addEventListener('DOMContentLoaded', function() {
    if (navigator.userAgent.indexOf('Safari') != -1 &amp;&amp; navigator.userAgent.indexOf('Chrome') == -1) {
        var productAttr = document.getElementsByClassName('product-attributes');
        productAttr.style.top = "-90px";
    }
});
</code></pre>

<p>The error from console is:</p>

<blockquote>
  <p>TypeError: 'undefined' is not an object (evaluating 'productAttr.style.top = "-90px"')</p>
</blockquote>

<p>If I want change other styles f.e. opacity or color, I get the same problem.</p>

<p>How can I fix this ?</p>

<p>Thanks in advance for help.</p>