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 CSS Layout Basics Getting Started with CSS Layout Why Vertical Margins Collapse

So do some block elements come predefined with certain margins and paddings already applied to them?

.

2 Answers

Steven Parker
Steven Parker
231,275 Points

You asked a very similar question two days ago. And I said:

Some elements have padding or margins by default, but most do not.

Here's a CSS Default Values Reference on w3schools.com that shows the values different elements have by default.

.

Steven Parker
Steven Parker
231,275 Points

There's no default padding. The white space is the margin between the body and the html element. Elements that cover 100% of the body still don't reach the edges of the window because of that margin.

Note that there would be no visible difference between margin on the body element (the default) and padding applied to the html element (not normally done).

.