title: How to make div fixed after you scroll to that div?
body: <p>How to make a <code>div</code> remain fixed after you scroll to that <code>div</code>? I have a <code>div</code> that is later in a page and you need to scroll to get to that <code>div</code>.</p>
  
  <p>If I use:</p>
  
  <pre><code>.divname {
    position: fixed;
  }
  </code></pre>
  
  <p>The <code>div</code> will appear before it should appear normally. Maybe a good example of what I need is second ad on <a href="https://9gag.com/" rel="noreferrer">9gag</a>. If your screen resolution is low enough, you won't see that ad after you load the front page, but after you scroll down, you'll see the second ad and it will remain fixed while you scroll down.</p>