title: How do I overlap 2 text-divs in one wrapper div?
body: <p>There is wrapper div contains two div with different text. I need to change the text on hover and the gol is to place text2 div at the same position as text1. </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-css lang-css prettyprint-override"><code>.wrapper {
    background: red;
    width: max-content;
    padding: 20px;
  }
  
  .text1 {
    background: green;
    opacity: 1;
    transition: all 0.5s;
  }
  
  .text2 {
    background: yellow;
    opacity: 0;
    transition: all 0.5s;
  }
  
  .wrapper:hover&gt;.text1 {
    opacity: 0;
  }
  
  .wrapper:hover&gt;.text2 {
    opacity: 1;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wrapper"&gt;
    &lt;div class="text1"&gt;Text 1&lt;/div&gt;
    &lt;div class="text2"&gt;Text 2&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>How do I overlap 2 text-divs in one wrapper div?</p>
  
  <p><a href="https://stackoverflow.com/questions/2941189/how-to-overlay-one-div-over-another-div">This is</a> not exactly the same question, in the link author sets width: 100%; height: 100%; but I have to adjust the wrapper height and width to text size somehow.</p>