Prev | Current Page 79 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"

117).
Shorthand Properties
Some properties can be combined into shorthand notation??”a notation that allows
us to specify values for related properties in a single declaration.
Shorthand for Box Properties
One form of shorthand notation allows us to specify values for two, three, or four
sides of a box simultaneously, like this:
margin: 1em 2em 3em 4em;
That declaration is equivalent to these:
General Syntax and
Nomenclature
The Ultimate CSS Reference 40
margin-top: 1em;
margin-right: 2em;
margin-bottom: 3em;
margin-left: 4em;
The TRouBLe Mnemonic
Note the order in which these properties occur in the shorthand notation. They
appear in a clockwise order, starting at the top: Top, Right, Bottom, Left.
Remembering this order keeps you out of TRouBLe.
This form of shorthand notation can take one, two, three, or four values. If four
values are specified, they??™re assigned to the appropriate sides in TRouBLe order. If
only two or three values are specified, the ???missing??? side is assigned the same value
as the one opposite it.


Pages:
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91