Dave's Brain

Browse - Computer Tips - How can I make a sticky div on a webpage that doesn't move when the user scrolls?

Date: 2016may2
Platform: web
Keywords: ribbon

Q.  How can I make a sticky <div> on a webpage that doesn't move when the user scrolls?

A. Use position:fixed like this:

<div style="position: fixed; top: 0px; right: 0px;">I am sticky</div>

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.