title: Modify CSS properties with JavaScript without remplacing the older ones
body: <p>I'm trying to create a HTML element that moves according to the coordinates of my mouse. I'm using the 'mousemove' event and to move my element, I use the offsetX/Y event's property.</p>
  <p>If I only apply a horizontal move for example (so I only use offsetX), it will works. But when I apply the vertical move, it won't works anymore. I use the 'transform' CSS property and I know where the problem is, but I don't know how to solve it. It's because I apply a new property to move vertically, but then I delete the old property that let move the element horizontally.</p>
  <p>So do you know how can I add multiple CSS properties (the same) to an element ?
  I have tried to just add them together with &quot;+&quot; or in the same ``, but it doesn't work.</p>
  <p>I hope I have been clear, and sorry for my english :)</p>
  <p>Thank you in advance for your help :)</p>
  <p>My code :</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>let box = document.querySelector('.box');
  let x = document.querySelector('#x');
  let y = document.querySelector('#y');
  let area = document.querySelector('.area');
  
  area.addEventListener('mousemove', (e) =&gt; {
    x.innerHTML = e.offsetX;
    y.innerHTML = e.offsetY;
    box.style.transform = `translateX(${e.offsetX}px)`;
    box.style.transform = `translateY(${e.offsetY}px)`;
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.area {
    width: 1000px;
    height: 400px;
    margin: auto;
    border: 3px dashed red;
  }
  
  .box {
    width: 100px;
    height: 100px;
    border: 3px solid black;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="area"&gt;
    &lt;div class="box"&gt;&lt;/div&gt;
    &lt;p&gt;X : &lt;span id="x"&gt;&lt;/span&gt;&lt;/p&gt;
    &lt;p&gt;Y : &lt;span id="y"&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>