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 Basics (2014) The Box Model The Box Model Review

"The same order of values in the padding property applies to the margin shorthand property."

Hello,

Where can I review a video related to the following sentence:

"The same order of values in the padding property applies to the margin shorthand property."

2 Answers

The order is top, right, bottom, left and that applies to both padding and margin:

margin: 20px 5px 20px 5px;
padding: 20px 5px 20px 5px;

The above example demonstrates this. The first value is the top (20px), the second value is right (5px), the third value is bottom (20px) and the fourth and final value represents left (5px).

You could also reduce this to shorthand, if you are using identical values for top/bottom, left/right to:

margin: 20px 5px;
padding: 20px 5px;

In the above example 20px would represent top and bottom, and 5px would represent left and right.

top, right, bottom, left