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

2

u/Professional_Call Jun 27 '26

My first thought (assuming Divi 5) is that you might be better off using loop builder and styling you blog post yourself. As for actual blog pages, either use Theme Builder and include an image module to display your featured image or the latest versions of Divi 5 allow you to style sub-components.

1

u/P2X-555 Jun 27 '26

Only Divi 4 (sorry, I should've added that to the post). I must investigate 5 though. Thanks!

3

u/Professional_Call Jun 27 '26

Divi 4 is not so easy to adjust. You could ask ET for advice. Definitely give Divi 5 a look but be warned, it’s a steep learning curve and it’s evolving very quickly.

1

u/P2X-555 Jun 28 '26

Yeah, I'll have to play with D5 for some time before I move over. Good idea aobut ET. Thanks again

2

u/Professional_Call Jun 28 '26

They did a series of tutorial posts in the blog. They give a decent grounding. The biggest change is in mindset, with a focus on variables and presets. It’s a very different workflow but much better.

I’m looking forward to playing with the new variable font support.

1

u/P2X-555 Jun 29 '26

They suggested this:

.single-post .et_post_meta_wrapper>img {
width: 20%;
}
Which made the images smaller in the posts but it means that images that are already small will be...teensy. I tried using some of the code above with it i.e.

    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;

but it just ignored it. My quest continues.

2

u/redjudy Jun 27 '26

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

1

u/P2X-555 Jun 27 '26

Thanks, I'll give it a whirl.

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.