15Mar/100

Order of CSS Values in Borders, Margins or Padding.

The issue, what direction do each of the values below pad?

padding: 4px 5px 2px 7px;

The short answer is: top, right, bottom and left. TRBL

I can never remember the order of values when setting borders, margins or padding in css. If you have the same problem take a look below:

  • one value such as 10px to specify an equal margin on every side
  • two values, such as 10px 5px, to specify the top/bottom (first value) and right/left (second value) margin
  • three values, such as 10px 5px 2px, to specify the top (first value), right/left (second value) and bottom (third value) margin
  • four values, such as 10px 5px 2px 1px to specify the top, right, bottom and left margins respectively

Thanks to: http://htmldog.com/reference/cssproperties/margin/

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.