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!
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

Akila Mahesh
Courses Plus Student 2,433 PointsConfusion with how to make a website
How do I allow all images to fill their parent elements?
2 Answers

Jason Anello
Courses Plus Student 94,610 PointsHi Akila,
Is this from a challenge? If so, which one?
A width of 100% will allow an element to fill it's parent container.

Andrew Batz
9,846 PointsIf I have a <div> that I want an image to fill entirely, I find that div img{ width:100%; min-width: 100%; max-width: 100%; }
works. it's not pretty, but it works. Just make sure the parent <div> is the size you want it to be.