Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.