Jump to content

Sticky Property not Working

Go to solution Solved by MayaViolet,

Recommended Posts

Posted

Hi,

I am trying to make the the block #block-yui_3_17_2_1_1687611542744_293271 which says Hello World sticky on my website.

My HTML:

<div class="sticky">
  <p>Hello, World!</p>
</div>

CSS: 

#block-yui_3_17_2_1_1687611542744_293271{
  position: sticky;
  background:red;
  top:0;
}

However, I can't seem to make any element sticky. Can someone help with this?

  • Solution
Posted

Hey @nbamir - it looks like you have this code applied to your site:

 

html, body {
    overflow-x: hidden;
}

Anytime overflow-x is set to hidden, this will cause conflict with the sticky property. If you're having overflow-x issues, you can try to target the section in particular that is causing the conflict rather than the whole body to make sure your sticky section works. Hope this helps!

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.