字型
font:font-style | font-variant | font-weight | font-size | line-height | font-family ;
Margin & Padding
magin: magin-top | margin-right | margin-bottom | margin-left;
P {magin:20px;}
P {magin:20px 10px;}
P {magin:20px 10px 100px;} 上邊距20px,左右10px,下邊距100px
邊框
border:border-width | border-style | color
border-top:border-width | border-style | color
border_right:border-width | border-style | color
border-bottom:border-width | border-style | color
border-left:border-width | border-style | color
border-width: top | right | bottom | left
border-color: top | right | bottom | left
border-style: top | right | bottom | left
支援1-4個參數的縮寫
List 列表縮寫
list-style:list-style-type | list-style-position | list-style-image
Background 縮寫
background: background-color | background-image |background-repeat | background-attachment | background-position
color 縮寫
顏色
16進位的色彩值,如果每兩位的值相同,可以縮寫一半,例如:
#000000可以縮寫為#000;#336699可以縮寫為#369;
盒尺寸
通常有下面四種書寫方法:
•property:value1; 表示所有邊都是一個值value1;
•property:value1 value2; 表示top和bottom的值是value1,right和left的值是value2
•property:value1 value2 value3; 表示top的值是value1,right和left的值是value2,bottom的值是value3
•property:value1 value2 value3 value4; 四個值依次表示top,right,bottom,left
方便的記憶方法是順時針,上右下左。具體應用在margin和padding的
例子如下:
margin:1em 0 2em 0.5em;
CSS 內補距(CSS padding):
padding-top:5px; padding-bottom:10px; padding-left:15px; padding-right:20px;
即可縮寫為
padding:5px 20px 10px 15px; 或padding-top:5px; padding-bottom:5px; padding-left:10px; padding-right:10px;縮寫為padding:5px 10px;
CSS 外邊距(CSS margin):
margin-top:5px; margin-bottom:10px; margin-left:15px; margin-right:20px;
即可縮寫為
margin:5px 20px 10px 15px; 或margin-top:5px; margin-bottom:5px; margin-left:10px; margin-right:10px;縮寫為margin:5px 10px;