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

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,567 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,109 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!