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

HTML How to Make a Website Adding Pages to a Website Add Iconography

Steve Isaacs
Steve Isaacs
2,112 Points

Why are the Margin and Padding shorthand numbers different in the example?

The correct code in this challenge shows this for padding and margin:

css:
 padding: 0 0 0 30px;
 margin: 0 0 10px;

But why does padding show four values and margin show three? Aren't they both trying to show just a value for the bottom? I'm confused.

2 Answers

Hi Steve,

This question here is linking to the video so I'm not sure if you're referring to that or a code challenge afterwards.

The 10px for the margin value is for the bottom but the 30px padding value is for the left side, not the bottom. This is to make room on the left for the icons.

4 values:

1st value is for top then it goes in a clockwise direction around the box. top, right, bottom, left

3 values:

1st value is top, 2nd value is both left and right, 3rd value is bottom.

2 values:

1st value is top and bottom, 2nd value is left and right.

1 value:

All 4 sides get that value.

Steve Isaacs
Steve Isaacs
2,112 Points

Ahhh ok. Got it. Thanks again, Jason.