**background**
* 描述:復合屬性。設置對象的背景特性
* 版本:CSS1 | CSS3 該屬性在 CSS3 有修改
* 繼承性:無
**語法**
復合屬性的每個屬性的值在獨立屬性中查看。
```
background:background-image | background-position[/background-size] | background-repeat |
background-attachment | background-origin | background-clip | background-color ;
```
* background-image:設置對象的背景圖。可以是真實圖片路徑或使用漸變創建的“背景圖”。
* background-position:設置對象背景圖的位置。
* background-size:設置對象背景圖的尺寸大小。
* background-repeat:設置對象背景圖如何鋪排填充。
* background-attachment:設置對象背景圖是隨對象內容滾動還是固定。
* background-origin:設置對象背景圖像顯示的原點。
* background-clip:設置對象背景圖向外裁剪的區域。
* background-color :設置對象的背景顏色。
**使用說明**
1. 一個元素可以設置多重背景圖像,每組屬性間使用逗號分隔。如果設置的多重背景圖之間存在重疊,前面的背景圖會覆蓋在后面的背景圖之上。
2. bg-color 只能設置一次,且由于寫在前面的背景會疊在之后的背景之上,推薦背景色定義在最后一組上,避免背景色將圖像蓋住。
```
background: url(../img/01.jpg) 10px 10px/50px 50px no-repeat scroll content-box padding-box,
url(../img/02.jpg) 20px 20px/100px 100px no-repeat scroll content-box padding-box,
url(../img/03.jpg) 30px 30px/200px 200px no-repeat scroll content-box padding-box #ff6600;
```

拆分方式:
```
background-image:url("../img/01.jpg"),url("../img/02.jpg"),url("../img/03.jpg");
background-repeat:no-repeat;
background-attachment:scroll;
background-position:10px 10px, 20px 20px, 30px 30px;
background-size:50px 50px,100px 100px,200px 200px;
background-origin:content-box;
background-clip:padding-box;
background-color:#ff6600;
```
如果 background-origin 和 background-clip 設置了相同的值。
可以這樣設置
```
background: url(../img/01.jpg) 10px 10px/50px 50px no-repeat scroll padding-box #ff6600;
```
表示 background-origin 和 background-clip 都使用了padding-box 參數值。
- 空白目錄
- CSS3專業名詞
- 復合屬性
- 繼承性
- CSS3背景
- background
- background-color
- background-image
- background-repeat
- background-attachment
- background-position
- background-origin
- background-clip
- background-size
- CSS邊框
- border
- border-width
- border-style
- border-color
- border-top
- border-top-width
- border-top-style
- border-top-color
- border-right
- border-right-width
- border-right-style
- border-right-color
- border-bottom
- border-bottom-width
- border-bottom-style
- border-bottom-color
- border-left
- border-left-width
- border-left-style
- border-left-color
- border-radius
- border-top-left-radius
- border-top-right-radius
- border-bottom-right-radius
- border-bottom-left-radius
- CSS顏色
- color
- opacity
- CSS字體
- font
- font-style
- font-variant
- font-weight
- font-size
- font-family
- font-stretch
- font-size-adjust
- CSS定位
- position
- z-index
- clip