Shorthand Property

From CSS Discuss

Jump to: navigation, search

Shorthand properties in Cascading Style Sheets regroup several properties in a logical way. They are a convenience to the author. Values are separated by spaces.

For example: font: can combine font-style, font-variant, font-weight, font-size, line-height and font-family, etc. in one declaration. example:

font:italic bold 1em/1.4 Tahoma,"Trebuchet MS",sans-serif;

as opposed to:

font-style:italic;
font-weight:bold;
font-size:1em;
line-height:1.4;
font-family:Tahoma,"Trebuchet MS",sans-serif;

However, there are drawbacks. If not all properties of the group are set with the shorthand, certain assumptions are made...



Personal tools