I would like to create a div, that is situated beneath a block of content but that once the page has been scrolled enough to contact its top boundary, becomes fixed in place
As of January 2017 and the release of Chrome 56, most browsers in common use support the position: sticky
property in CSS.
#thing_to_stick {
position: sticky;
top: 0px;
}
does the trick for me in Firefox and Chrome.
In Safari you still need to use position: -webkit-sticky
.
Polyfills are available for Internet Explorer and Edge; https://github.com/wilddeer/stickyfill seems to be a good one.