title: Use CSS transition only for increasing value
body: <p>In my code, I want to use the transition only when the width turns wider.
  When the width decrease I don't want any animation.
  can I do with CSS only? Add/remove classes is not an option for me.</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>function changeCss() {
    document.getElementById('squareId').style.width = "300px";
  }
  
  function reset() {
    document.getElementById('squareId').style.width = "100px";
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.square {
    background-color: red;
    width: 100px;
    height: 100px;
    transition: width 1s linear;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="squareId" class="square"&gt;&lt;/div&gt;
  
  &lt;button onclick="changeCss()"&gt;increase&lt;/button&gt;
  &lt;button onclick="reset()"&gt;decrease&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://jsfiddle.net/hd1u5y09/12/" rel="nofollow noreferrer">JSFiddle</a></p>