Site logo

Archived topic

CSS for Sticky Sidebar Element

10 replies · Started by Kelsey on March 13, 2022

Viewing posts 1–11 of 11

Hello,

How can I make the bottom element on this sidebar element sticky?

https://thegoldenlamb.com/rankiq-keyword-niches/

You provided excellent CSS for regular posts with sidebar widgets but it doesn't work for elements.

Thanks,

Kelsey

Hi there,

try adding this CSS;

@media(min-width: 769px) {
    .inside-right-sidebar *:last-child {
        position: -webkit-sticky;
        position: sticky;
        top: 20px;
    }
}

hm, that didn't work for me.

Hi Robert,

your site is still using the old floats grid, so you would need some CSS like this:

@media(min-width: 1024px) {
    .site-content {
        display: flex;
    }
    .inside-right-sidebar {
        position: -webkit-sticky;
        position: sticky;
        top: 20px;
    }
}

That seemed to work. What is the old floats grid? And should I be using something newer? It's a new site with all the current versions. Thanks

Thanks, David! Worked like a charm.

Glad to hear that

Switched to flex, works great! Thanks for the A+ support.

Glad to hear that too!

This archived topic is closed to new replies.