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 Responsive Web Design and Testing Responsive Web Design

What is meant by "parent container"?

In this video and some other ones, there is a reference to the phrase 'parent container'. In particular, we've set the max-width of images to 100% so that they don't get out of frame as the screen size changes.

What I'm trying to understand is if parent container refers to the size of the browser window/screen, the size of an element such as a <div> or <section> that the images are contained inside of, or something else entirely.

This is the only context so far which I've encountered 'container' here, hence my confusion.

EDIT: Just wanted to post for posterity that my understanding of this topic is MUCH clearer after watching the first few videos in the CSS Layout Basics course.

5 Answers

Reece Palmer
Reece Palmer
3,197 Points

I believe a parent container is an element that contains another element. For example if you have a div that contains a img tag, when you set the max-width to 100% it will make the image cover 100% of the div that contains it.

Meg Matty
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Meg Matty
Front End Web Development Techdegree Graduate 22,928 Points

I remember it this way: a parent wraps itself around his/her child, to show it loves them. :D

So container is just a box, basically, empty until something goes inside it. Parent is the relationship to that thing inside (the child). You can make an empty <div> that is a container, but it isn't a parent until there's a child element for it to wrap itself around (like an <img>).

Bryce Santos
Bryce Santos
11,157 Points

So let's say you have

<nav>
   <ul>
   </ul>
</nav>

ul is the child of nav, with nav being the parent element.

Bryce Santos
Bryce Santos
11,157 Points

Exactly as the people before me stated.

The parent container is what holds the child inside. If you were to draw a big box with a little box inside of it, the bigger box would be the parent, the smaller box INSIDE would be the child.

So just to reiterate- here "parent container" is referring to an element? I grok the concept of nesting/parent and child elements