In this example the inner grey div should be behaving like a sticky div – so it sticks to the top of the screen when you scroll down the page – but that ain’t happening! What have I got wrong?
<html>
<body>
<div style="position: absolute; top: 150px; left: 150px; border: 1px solid red">
<div style="position: sticky; top: 0; background-color: #ddd; padding: 20px; margin: 30px">
Richard is the best
</div>
</div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>