Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Sticky sidebar won’t work anymore

  • Hello, I ve looked eveywhere in here but I cant find a working CSS.

    So I want the last widget of my right sidebar to be sticky.

    This code here used to work, but not anymore…I dont know why.

    
    .site-content {
      display: flex;
    }	
    .inside-right-sidebar {
      height: 100%;
    }		
    .inside-right-sidebar aside:last-child  {
    	position: -webkit-sticky;
    	position: sticky;
    	top: 45px;
    	bottom: 30px;
    	padding-bottom: 83px;
    } 

    The thing is, if I try the following, then the whole sidebar stays sticky. So it does work then.

    .inside-right-sidebar {
        position: -webkit-sticky;
        position: sticky;
        top: 0px;
        
    }

    Any ideas why the first code doesn’t work at all?
    You can see my page in the private info field.

  • Hi there,

    Try replacing aside:last-child in your code with aside:last-of-type.

    Let us know how it goes.

  • It works! So why did the code change?

    Also do I need this piece of code if I am already using flexbox structure?

    .site-content {
      display: flex;
    	}

    Cause I think it works without it too…

  • Hi there,

    the :last-child psuedo-element requires ALL the elements to be the same type eg. <aside>.
    However, Ezoic has injected a bunch of <ins> elements for its ad placement in there too. So it fails.
    Hence the need to use :last-of-type as that can handle mixed content.

    And this:

    
    .site-content {
      display: flex;
    }
    

    You’re correct, is not required as the theme adds it.

  • Thanks so much for the explanation, David.

    You guys are always so helpful and I appreciate it so much! 😊

  • I am so glad to hear that 🙂

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