Archived topic
How To Make Container Sticky in Sidebar?
7 replies · Started by Jeffrey on January 14, 2023
Hey,
In my sidebar, I have sticky Table of Content ("Easy Table of Contents" plugin has option to make it sticky, so it works well).
Now I want to add new container after "Table of Contents" which will be also sticky.
Please help.
Hi there,
can you share a link to a page on your site where i can see the ToC?
Here is staging
With CSS unless the exact height is known for each "widget" you can't sticky just the first two.
You would have to make the whole sidebar sticky, so remove your current sticky CSS and add this instead:
@media (min-width: 768px) {
#right-sidebar .inside-right-sidebar {
position: sticky;
top: 20px;
}
}
Thank you David.
Where should I indicate that CSS?
Do you mean style.css or somewhere else?
Hi Jeffrey,
You can use one of the methods introduced here:
Adding CSS: https://docs.generatepress.com/article/adding-css/
Thank you!
No Problem :)