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 How to Make a Website CSS: Cascading Style Sheets Center the Wrapper

Need some comments regarding margin property.

Nick said : In other words, if we were to take the entire width of the page and then subtract 940 pixels in >the middle, the rest of the space on the left

subtract in the middle ? Why in the middle ? Why not from left side or right , please give me more comments regarding this.

Thank you.

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hmm..

The middle is the actual space of the content. When you have an element of a width of 940pixels wide, it is 940pixels wide. But you can do some things to your element that will increase the space that element takes up.

Margins increase the space outside your element from another element. Padding, increases the space of content like text from the edge of an element.

Margin

Padding

Content.

So applying a margin or padding of

margin: 0;
padding: 0;

Would make sure any default margins and paddings are overridden, so your element remains 940px wide.

This is what's known as the Document Object Model. :-)

Hi,

okey, thx. Well I need some more practice . But for now I should to know that the middle it's an actual space of the content.