Jump to content

Fit parent div to child img?


Recommended Posts

I have a div that contains an img and text. The img is floated left at 40% width. The height of the img and  the amount of text may vary. What I want to do is make sure the parent div is at least high enough to enclose the img. (It may be higher if the text is longer than the img, but that case works fine already.) I've tried various overflow settings, but none seem to accomplish this. Is there a way using css or straight js?

Screen Shot 2020-04-14 at 12.47.25 PM.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...