Welcome to the Instapage Support Center


Add a sticky header to your page (top block only)

In order to transform the top page block into a sticky header that stays in place when you scroll down the page, you would just need to add in this code on your page. 

First, add the following JavaScript code in the Settings - JavaScript menu of your page, in the Footer section: 

const header = window.__page_generator ? document.querySelector('.section') : document.querySelector('.page-block');
const headerHeight = header.clientHeight;
document.querySelector('body').style.marginTop = headerHeight + 'px';

And now add the following CSS styles in the Settings - HTML/CSS - Head:

position: fixed;
top: 0;
width: 100%;
z-index: 11000000;

That's it!

You can check out a demo here: 

Live Example

Note: Do not add buttons that activate a pop-up in the block that will be a sticky header.

Have more questions? Submit a request
Was this article helpful?
20 out of 38 found this helpful

Need Further Help?

Tell us what you need and we will be happy to assist you.

Our team of expert support staff and our community can answer your questions. Submit a ticket, or reach out on live chat!