title: Fix an element horizontally, but not vertically with css
body: <p>I have an overlay element in a container which scrolls horizontally.</p>
  <p>I want this overlay to be fixed in place horizontally, but if I scroll the window, the overlay should scroll along with the page.
  <a href="https://jsfiddle.net/Lvy9uq0n/1/" rel="nofollow noreferrer">https://jsfiddle.net/Lvy9uq0n/1/</a></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>.box {
    height: 300px;
    width: 3000px;
    background: white;
    border: 1px solid black;
  }
  
  .overlay {
    position: fixed;
    left: 50%;
    padding: 10px;
    width: 200px;
  }
  
  html,
  body {
    height: 1000px;
  }
  
  .container {
    overflow-x: scroll;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;
  
    &lt;div class="box"&gt;
      &lt;div class="overlay"&gt;
        Overlay
  
      &lt;/div&gt;
    &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;div syle="height:1000px"&gt;
  
    Test
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>TLDR: Element should be fixed inside a container horizontally but not vertically</p>