Site logo

Archived topic

How to Make Ads widget Sticky in sidebar

11 replies · Started by Sourabh on December 23, 2020

Viewing posts 1–12 of 12

Hi,

I have added an image widget from the GP widgets section into my RHS sidebar and have placed an affiliate ad (Its not google ads, but I will implement google ads later as well), so how to make it sticky, and it should be sticky till last where post end, But should not overlap footer area, I am sharing credential and page etc for further understanding -

Also, one more thing, how to remove that line above the image from that specific widget and make this imaging center align ??

Hi there,

Let's tackle one question at a time.

Can you try this CSS first and see if the sticky works?

@media (min-width: 769px) {
    .site-content {
        display: flex;
    }
    .inside-right-sidebar {
        height: 100%;
    }
    .inside-right-sidebar aside:last-child {
        position: -webkit-sticky;
        position: sticky;
        top: 150px;
    }
}

You can just the 150px to position it higher/lower.

Yes its working and added, top: 70px; is okay for me. Thanks

Now try this CSS:

.right-sidebar aside:last-child h2.widget-title {
    border-bottom: 0;
    padding-bottom: 10px;
}
.right-sidebar aside:last-child h2.widget-title:after {
    display: none;
}
.right-sidebar aside:last-child {
    text-align: center;
}

Need a small space from the top between Title and ads image ??

and this code will work when I will replace the personal ads banner with google ads??

Edited the CSS above.

This code will work as long as that's the last widget in the right sidebar widget area.

Okay, Thanku Leo.

No problem :)

Wow, works like magic! Thank you @david, always spot on!

Glad to be of help

This archived topic is closed to new replies.