title: CSS: Replacing a text on hover, but smooth transition to the new text does not work?
body: <p><strong>The scenario:</strong> </p>
  
  <p>If a user hovers over a text (e.g. an h1-tag), it should change to a new text. The new text should appear smoothly. </p>
  
  <p><strong>What I've done so far:</strong></p>
  
  <p>I was able to replace a text with a new one with the "display:none" and the "content: 'This is the new text' "-property. My problem is that the new text does not appear smoothly (it does not fade in/transitions). 
  I've also tried to use opacity, but it doesn't replace my old text (instead it just disappears and the new text appears next to it).</p>
  
  <p>Here is a <a href="https://jsfiddle.net/33eLvvm4/2/" rel="noreferrer">JSFiddle</a> and code snippet:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.my_div {
    background-color: red;
  }
  .my_div:hover {
    background-color: green;
    transition: all 500ms ease-in-out;
  }
  .my_div:hover .title span {
    display: none;
  }
  .my_div:hover .title:after {
    content: "A wild text appears";
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="my_div"&gt;
    &lt;h1 class="title"&gt;&lt;span&gt;This is the old text&lt;/span&gt;&lt;/h1&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>