Site logo

[Support request] CSS for Sticky Sidebar Element

Home Forums Support [Support request] CSS for Sticky Sidebar Element

Home Forums Support CSS for Sticky Sidebar Element

  • This topic has 10 replies, 3 voices, and was last updated 4 years ago by David.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #2152856
    Kelsey

    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

    #2153070
    David
    Staff
    Customer Support

    Hi there,

    try adding this CSS;

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

    hm, that didn’t work for me.

    #2153075
    Robert
    #2153087
    David
    Staff
    Customer Support

    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;
        }
    }
    #2153098
    Robert

    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

    #2153102
    David
    Staff
    Customer Support

    This doc explains the old Floats grid and how to move into flex box:

    https://docs.generatepress.com/article/switching-from-floats-to-flexbox/

    If you make that change then the CSS I provided the OP should work for you

    #2153147
    Kelsey

    Thanks, David! Worked like a charm.

    #2153174
    David
    Staff
    Customer Support

    Glad to hear that

    #2153192
    Robert

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

    #2153821
    David
    Staff
    Customer Support

    Glad to hear that too!

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.