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

CSS

Div "containers" Div "wrappers"

Im always using the "View source code" on websites I like, to see how they did something and I notice a lot of "Container" class or "wrapper" class

2 questions

1st. What exactly are those?

2nd. Why do people specifically name them those words and not whatever they want? is it a set standard?

Thanks you

4 Answers

Wayne Priestley
Wayne Priestley
19,579 Points

container or wrapper is the term most people use to describe the div that contains the whole page.

Its not a standard that they call it container or wrapper, but its a good description and as you have seen most people use it.

James Barnett
James Barnett
39,199 Points

> Its not a standard that they call it container or wrapper

The distinction here is a convention vs a standard.

Kevin Korte
Kevin Korte
28,148 Points

Yes, containers and wrappers are just terms. The actual word "container" or "wrapper" means nothing. It just connects CSS from the CSS file to that div. Container and wrapper often mean the same thing on a website, just depends on the developer and what they enjoy using.

A container or wrapper is a dummy div used for purposes of setting backgrounds, floats or padding on another div. Sometimes you need an parent div to get a block level element to do what you want, whether that's simply setting a background or using margin: 0 auto to center a block. People just call them wrappers out of custom and also that it's a very uncommon need for a class name. It means nothing technically.

Thank you All!