I've searched the W3C CSS2 Spec for the name of the feature that allows us to shrink duplicate values down to one or two like:
margin: 1px 1px 1px 1px; -> margin: 1px;
padding: 1px 1px 2px 2px; -> padding: 1px 2px;
But I'm still not sure what the exact name for this is. Does anyone know what this is called? Also, can you list some other properties that follow this behavior (besides the obvious ones like margin
, padding
, and border-radius
). I'm writing a re开发者_如何学Cgex that matches these properties and would like to include as many them as possible!
Thanks!
margin
is a shorthand property for margin-left
, margin-top
, etc.
margin: 1px 1px 1px 1px;
and margin: 1px;
are both shortcuts. In the later one for values collapsed into one. So collapsing probably.
As of other shorthands:
size
property (from printing module)border-width
,border-color
andborder-style
background-position
,background-size
, etc.
These are called CSS shorthand properties.
A list of some useful ones can be found here: http://cssdog.com/css_shortcuts.html
If compiling a list of as many as possible is your goal, here is a guide: http://www.dustindiaz.com/css-shorthand/
精彩评论