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

HTML How to Make a Website Styling Web Pages and Navigation Style the Portfolio

Akhter Rasool
Akhter Rasool
8,597 Points

What does parent containter mean?

img{ max-width:100%}

what does the teacher mean when he says that the image will shrink if the parent container shrinks, and without this statement the images will break,what is the parent container? Please explain

3 Answers

Josh Keenan
Josh Keenan
19,652 Points

It all depends on your CSS, if you are using responsive design techniques (which you'll learn about) then it will depend on the size of the window your using as well as monitor size (mobile or desktop). If not then whatever you set the size of it to be will be the constrains of it.

Josh Keenan
Josh Keenan
19,652 Points

The parent container is the container that holds the content they are referring to, so if it is a <p> element within a div, the div is the parent container

Akhter Rasool
Akhter Rasool
8,597 Points

So how does the parent container vary in size like adjusting the size of web browser??

Think about this like a bottle of water (parent container). If you start filling up the bottle with water (img) and don't stop, the water will overflow and spill out of the bottle. But if you do stop filling the bottle (set an max-width for the image), it won't overflow. Now think about what happens when you squeeze the water bottle (resize browser window). Without a cap (max-width) on the bottle, the water would shoot out.