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 Styling Web Pages and Navigation Create a Horizontal List of Links

how to add a top padding to top and bottom 15px , and left and right 10px

how to add a top padding to top and bottom 15px , and left and right 10px

3 Answers

Jack Choi
Jack Choi
11,420 Points
padding: 15px 10px;

which is just shorthand for

padding: 15px 10px 15px 10px;

which is also shorthand for

padding-top: 15px;
padding-right: 10px;
padding-bottom: 15px;
padding-left: 10px;

h1 { padding: 15px 10px 15px 10px; }

Padding and margin can be use this way. Its is in a clockwise process of "TOP RIGHT BOTTOM LEFT".

Meagan Austin
Meagan Austin
3,392 Points

The padding property's order in the declaration is top, right, bottom and left. So it would look like that:

Example:

padding: 15px, 10px 15px 10px;

The shorthand version of the padding's order in a declaration would top and bottom is one value and left and right is another.

Example:

padding: (top, bottom), (left, right);

padding: 15px, 10px;

Hope this helps.