Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

[Flexbox]: Shrinking images within a flex child

I have a flex box that contains three columns (three divs) as its flex children. The columns shrink in the proportions that I want them to when I resize the browser, BUT I also want an image inside of one of the columns to shrink down when the browser gets below a certain size.

What's the best way to do this?

2 Answers

Make your images fluid by giving them attributes and values such as max-width: 100%; and height: auto;

Example:

<img src="image.jpg" style="max-width:100%; height:auto;" alt="This is an Image">

Ah, it works perfectly! Thanks!

You're welcome! :)