Archived topic
Add "object-fit" for featured images in custom css
5 replies · Started by Leon on September 14, 2018
I'm using square featured images and want to use object-fit for them. How do I create that? In custom css?
Thanks,
Leon
Hi there,
What are you trying to achieve with object-fit? Any examples?
As you can see on http://l-seven.nl/wordpress/?page_id=12455 I've made all featured images square.
I want the images to fill the square and crop if necessary and read that object-fit cover should do exactly that:
https://css-tricks.com/almanac/properties/o/object-fit/
I tried to add that in custom css but it didn't work. Hope you can help.
Thanks,
Leon
Hi there,
try this additional CSS:
.post-image-aligned-center .post-image img {
width: 110px;
height: 110px;
object-fit: cover;
}
That did it. Thank you very much for you fast reply.
Leon
You're welcome. Glad we could help :)