Make Sticky Element (Box, Text, Image etc) Using CSS

Make sticky section, box, text, image anything using css code. In this article i share my own knowledge with you. Simple paste or change something.

How to Do

  • First of all add position: relative; in parent’s class or style.
  • Then add position: -webkit-sticky; position: sticky; top: 0; in class or style for making sticky.

Example: –

<div style="position: relative">
<div style="position: -webkit-sticky; position: sticky; top: 0;">
Hello this my demo code making sticky element
</div>
</div>

This is just a example, you can implement in your code.