Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Resize image to max height of height: auto container - this seems like it should be easy. - Kevin Powell - Community
KP-C
Kevin Powell - Community
•
3y ago
•
4 replies
sheepman
Resize image to max height of height: auto container - this seems like it should be easy.
Rather than trying to explain what I
'm doing
, here
's a codepen
:
https://codepen.io/sheepman4267/pen/zYMvJbY
I want the div to be the minimum height of the text it contains
, and I want the image to grow
/shrink with that
. Logically
, it seems to me like
height: min-content
height: min-content
on the div and
height: auto
height: auto
on the image should do this
, but it doesn
't
. Is there a pure CSS way to do this
, or am I going to have to mess with JS
?
Kevin Powell - Community
Join
A friendly place for developers to meet other devs, ask questions, get help, and just have a good time 🙂.
36,263
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
image resize
KP-C
Kevin Powell - Community / front-end
3y ago
How to make such auto-scrolling given fixed height of container ?
KP-C
Kevin Powell - Community / front-end
3y ago
Keeping the height of the image while changing the height of the absolute container
KP-C
Kevin Powell - Community / front-end
3y ago