title: How to disable transition if there are words in a search bar?
body: <p>I have a search bar that has a transition animation applied to it.</p>
  <p>Initially the bar looks like this:
  <a href="https://i.stack.imgur.com/hOFnx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hOFnx.png" alt="search bar, initial" /></a></p>
  <p>On hover, it transitions to look like this:
  <a href="https://i.stack.imgur.com/fexfW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fexfW.png" alt="enter image description here" /></a></p>
  <p>The issue starts here. When I hover away from the text/bar, the bar transitions back to the initial bar. When hovered back, any text written is still there. I want it to be such that the transition is disabled when the bar is active. (So that, the user still sees the text despite hovering away from the bar.)</p>
  <p>Below is the CSS for the search bar:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>/* search */
  
  .search-box {
    background: #2f3640;
    height: 20px;
    border-radius: 40px;
    padding: 10px;
  }
  
  .search-box:hover&gt;.search-txt {
    width: 240px;
    padding: 0 6px;
  }
  
  .search-box:hover&gt;.search-btn {
    background: #5b9cdd;
    color: #2f3640;
  }
  
  .search-btn {
    float: right;
    width: 30px;
    height: 30px;
    transform: translateY(-5px);
    border-radius: 60%;
    background: #2f3640;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.2s;
    color: #5b9cdd;
    cursor: pointer;
  }
  
  .search-btn&gt;i {
    font-size: 20px;
  }
  
  .search-txt {
    border: none;
    background: none;
    outline: none;
    float: left;
    padding: 0;
    color: white;
    font-size: 16px;
    transition: 0.5s;
    line-height: 20px;
    width: 0px;
    font-weight: normal;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!-- search section of the header --&gt;
  &lt;div class="search-box"&gt;
    &lt;input type="text" name="" class="search-txt" placeholder="What are you searching for?" /&gt;
    &lt;a class="search-btn"&gt;&lt;i class="fa fa-search"&gt;&lt;/i&gt;&lt;/a&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>