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 trialMax Krivosheev
479 Points"now we have a little more control over our layout"
Hi, my question is not unique. There is the same question here: https://teamtreehouse.com/forum/body-vs-wrapper-div-a-little-more-control
But there is no answer!
Could, please, Guil answer it in detail and with examples?
1 Answer
Jake Rorrer
17,788 PointsThe reason he says it adds more control is because of css's specificity trait. By adding a class to the html tag with the value "wrapper" you can now directly control that class within the css, for example:
.wrapper {
margin: 0 auto;
width: 1000px;
}
body {
margin: 0;
width: 900px;
}
In this example, .wrapper takes precedence over body due to specificity. If you had multiple body elements, only the one with .wrapper would be styled with the .wrapper styling, hence giving you more control over your css styling. Hope this helps!
Andres Hamilton
7,594 PointsAndres Hamilton
7,594 PointsThanks it's clear now