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 trialdanielelsamman
3,525 Pointswidth: 100% X max-width: 100%
Why not to use just width: 100% instead of max-width: 100%?
1 Answer
Steven Parker
231,248 PointsThose mean different things. A "width: 100%
" setting would require the element to span the entire window and force it to expand to fill (or shrink to fit) the space.
But "max-width: 100%
" would still shrink the element to fit if it was too large, but it would not cause the element to expand if it was smaller than the full size.