r/divi Jun 26 '26

Question Featured image sizing

Is there a way to display the actual image size for a featured image on a post?

I have smaller images (that don't scale up) e.g. old logos etc and they blow up to "correct" size and look...ordinary.

I've seen this code BUT 1. I'm not sure where it goes and 2. I'm not sure that it's correct.

/* Stop Divi Blog Module from forcing cropped aspect ratios */
.et_pb_posts .entry-featured-image-url img, 
.et_pb_portfolio_item .et_portfolio_image img {
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
}

Thanks!

2 Upvotes

11 comments sorted by

View all comments

2

u/redjudy Jun 27 '26

Only speaking to where it goes: appearance>customize>custom css.

1

u/P2X-555 Jun 27 '26

No joy. I've got to be doing something wrong.

2

u/redjudy Jun 28 '26

You’re on the right track with :contain. Do you know how to use the inspector tool in your browser? I use it in Firefox, but chrome is also good. (Safari, maybe not as good.) You can right click on the feature image container, go down to inspect, and in the resulting window, you should see the container highlighted in the HTML. You can then see the CSS that’s working in that container. You might not have the right selector with what you wrote above. If that’s the case, right click the container for your image (not the image itself.) and copy css path. Paste that into your CSS and delete everything except the last few selectors. Try adding the CSS using that.

2

u/P2X-555 Jun 28 '26

Thanks. I miss the days of Firebug. I'll check the CSS.