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 trialJ V
3,414 PointsWhy do we have to set max-width for 'img' header in order for the width to adjust properly in the 'resort/tips' classes?
Here is the portion of the CSS code:
img { max-width: 100%; margin-bottom: 20px; }
.resorts, .tips { width: 46.5%; }
If I comment out img value max-width: 100%; then the image width does not adjust to 46.5%. Why is this the case?
1 Answer
Jake Lundberg
13,965 PointsBecause you have to specifically tell the image to fill 100% of the width of the containing element. If you comment that out the image assumes its default size (the size of the actual image).
J V
3,414 PointsJ V
3,414 PointsHi Jake,
Thank you for answering.