Site logo

Archived topic

Change border radius for images embedded in posts & pages

5 replies · Started by Sasha on July 18, 2021

Viewing posts 1–6 of 6

Hello – 

Please take a look at my CSS and tell me what I am doing wrong :)

I would like all embedded images in posts & pages to have a border radius of 5px. So far, I am able to style featured images, archive page featured images, and WP Show Posts featured images... but in-line images in the posts/pages are not effected. (I do not want this to apply to images in hooked elements, though.)

EDIT: I would also like to add border radius to Dynamic featured images used in my search results content template :)

/* image border radius */
.post-image img, .page-header-image-single img {
    border-radius: 5px;
}

.wp-show-posts-image img {
    border-radius: 5px;
}

.wp-post-image img, .wp-block-image img {
    border-radius: 5px;
}
	

Hi there,

Edit:

.wp-show-posts-image img {
    border-radius: 5px;
}

.wp-post-image img, .wp-block-image img {
    border-radius: 5px;
}

to this:

.wp-show-posts-image img {
    border-radius: 5px !important;
}

.wp-post-image img, .wp-block-image img {
    border-radius: 5px !important;
}

Thanks Leo! That is working for images embedded in blog posts & pages!

... but not for Dynamic images on my search results content template. Please help :) (sample URL in private info)

I will soon apply this content template to all archive pages, so hopefully the solution will work for that outcome as well.

Thanks again!

Try this as well:

.search .dynamic-content-template.post img {
    border-radius: 5px;
}

Works like a charm! Thanks Leo! :)

No problem :)

This archived topic is closed to new replies.