Closed
Description
Steps to reproduce the problem:
- Add
<p>
element with text and optionally withmargin
and some other elements before the element you want to set as a sticky - Set position:
sticky; top: 0;
on the element, you want to be sticky - Scroll down to see that element is actually stays in its place and doesn't behave as a sticky.
What is the expected behavior?
The element should behave as a sticky element.
What went wrong?
The element stays in its place and doesn't behave as a sticky.
Code example: http://bit.ly/2HeL6Si
NOTE:
Position sticky won't work until there are HTMLElements before it in the DOM e.g. <p>
element with margin. If you, however, delete all the elements before it in the DOM position sticky will work as expected.
Chrome version: 74
OS Version: Windows 7