Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

CSS Properties

Short form for padding, border and margin padding, border and margin can be explicitly defined, which can be preferred for ease of maintenance and readability.

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

This can however be shortened in various ways, the shortest being:

padding: 15px;

So the padding is applied the following way:

If you use two parameters:

padding: 15px 15px;

If you use three parameters:

padding: 15px 15px 15px;

And finally if you use four parameters:

padding: 15px 15px 15px 15px;

See also HTML Dog, there are separate explanations for padding, border and margin, but the use and behavior is the same.