CSS Shorthand

font: style variant weight size/line-height family;
background: color image repeat attachment position;
border: width style color;

Properties in bold are the only required values.
The order of properties is important.

Margin and Padding

There are multiple ways you can show Margins or Padding without fully specifying “margin-top”, “margin-right”, etc. You can do it all on one line with “margin” or “padding” only.

1. top right bottom left
margin: 10px 5px 15px 10px;

2. top/bottom right/left
margin: 10px 0px;

3. all the same (top/bottom right/left)
margin: 10px;

padding: (same shortcuts as margin)

The simplest way for me to remember the order of positions is to think of a clock face. Top, Right, Bottom, Left is the order of 12, 3, 6, 9 on the clock.

Leave a Reply

Your email address will not be published. Required fields are marked *