Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Layout CSS Layout Techniques Relative and Absolute Positioning

David Douglas
David Douglas
2,469 Points

widths?

This may be a stupid question. An aside element, for example, has a width of 100% and a max-width of 480px. How is it that if another element within the aside does not have the same set max-width it will extend pass the 480px? Shouldn't the aside's max-width stop element from stretching across the screen?

1 Answer

Steven Parker
Steven Parker
215,940 Points

The max-width property isn't inherited by default, but you could explicitly set max-width: inherit; in the inner element.

You could also give the parent element overflow: hidden; to constrain the visible portion of child elements.