CSS code simplification is very useful and necessary in the work. When writing CSS code, there is often redundant code, in order to improve the quality of the code and file compression to the minimum, so that the code is readable, have to simplify the CSS code. Here's an example of some of the more commonly used properties.
Margin
margin-top:1px;
margin-right:1px;
margin-bottom:1px;
margin-left:1px;
Code simplification to: margin:1px
margin-top:1px;
margin-right:2px;
margin-bottom:1px;
margin-left:2px;
Code simplification to: margin:1px2px
margin-top:1px;
margin-right:2px;
margin-bottom:3px;
margin-left:2px;
Code simplification to: margin:1px2px3px
margin-top:1px;
margin-right:2px;
margin-bottom:3px;
margin-left:4px;
Code simplification to: margin:1px2px3px4px
Note: When the property value is 0, the unit can not write as: 0px directly written 0
Padding
The writing method of padding is similar to margin
padding-top:1px;
padding-right:1px;
padding-bottom:1px;
padding-left:1px;
Code simplification to: padding:1px