Site logo

[Support request] Hi! How to make the sticky sidebar only on post, but not pages/archive pages?

Home Forums Support [Support request] Hi! How to make the sticky sidebar only on post, but not pages/archive pages?

Home Forums Support Hi! How to make the sticky sidebar only on post, but not pages/archive pages?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2605335
    vincenteccl

    Hi! I have used this CSS to make the last sidebar (table of content) to be sticky:


    @media
    (min-width: 769px) {
    #content {
    display: flex;
    }

    .inside-right-sidebar {
    min-height: 100%;
    }

    .inside-right-sidebar>*:last-child {
    position: sticky;
    top: 30px;
    }
    }

    But it makes sidebars on the archive page sticky too.
    I only want the CSS to apply to posts, but not pages.
    How to do it?
    Thanks.

    #2605948
    Ying
    Staff
    Customer Support

    Hi there,

    Change your CSS to:

    @media (min-width: 769px) {
    .single-post #content {
    display: flex;
    }
    
    .single-post .inside-right-sidebar {
    min-height: 100%;
    }
    
    .single-post .inside-right-sidebar>*:last-child {
    position: sticky;
    top: 30px;
    }
    }
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.