Archived topic
How to make ads sticky in right sidebar
9 replies · Started by Camilla on November 20, 2021
Hello,
I'd like to add one ad unit to the right side bar and make it sticky. How can I do it via CSS?
I've searched on the forum but still have no idea how to add specific ads unit tag. This is the ads unit tag:
Thanks advance for your help.
Camilla
Hi there,
the CSS will vary depending on how it is added to the sidebar.
If you can share a link to a post where i can see the advert in the sidebar then i can advise.
Hi David,
This is one of the posts on my site:
https://mostechtips.com/fix-new-world-stuck-on-loading-screen-issue/
I am not seeing any advert in the sidebar ?
Sorry. The advert is available now.
Hi Camilla,
I'm seeing 2 ad widgets on the sidebar of your site. Would you like both to be sticky?
If that's the case, try adding this CSS:
.inside-right-sidebar {
min-height: 100%;
}
aside.widget.inner-padding.moste-widget {
position: sticky;
top: 60px;
}
aside#block-3{
position: sticky;
top: 400px;
}
If it's only for the last widget, try this CSS:
aside#block-3{
position: sticky;
top: 60px;
}
Hi Elvin,
Thanks for your help. I tried to make the last widget sticky by using the second CSS code you provided, but it doesn't seem to work. The ad is not sticky.
Ah I forgot to mention that you should always include this part:
.inside-right-sidebar {
min-height: 100%;
}
This CSS makes the path for the sticky-ness. :)
It worked. Thanks Elvin.
Nice one. No problem. Glad to be of any help. :D