Site logo

Archived topic

CSS Targeting Just In-Body Posts

5 replies · Started by Ian on August 8, 2022

Viewing posts 1–6 of 6

I am running these inside the child theme's stylesheet:

/* H2 & h3 margins */
body.single-post h2,
body.single-post h3, {
margin-top: 25px;
}

/* image padding */
img {
padding: 25px 0 25px 0;
}

Noticed that it's affecting the rest of the site. Is there more specific targeting that I can use to limit this just to the inside portion of blog post content?

Doh! I think I have the image sorted:

/* image padding */
.entry-content img {
padding: 25px 0 25px 0;
}

What about the H2 and H3? Thank you in advance!

.single-post .entry-content h2,
.single-post .entry-content h3 {
margin-top: 25px;
}

/* image padding */
.single-post .entry-content img {
padding: 25px 0 25px 0;
}

Hi Ian,

That CSS should work. Would you still need help regarding this? Let us know.

Thanks Fernando. That seems to work properly. Just wanted to make sure I got the proper targeting. Thx!

I see. Glad you got it working Ian!

This archived topic is closed to new replies.