background版本:CSS1  兼容性:IE4+ NS4+ 繼承性:無
語法:
background : background-color || background-image || background-repeat || background-attachment || background-position
取值:
該屬性是復合屬性。請參閱各參數對應的屬性。
默認值為:transparent none repeat scroll 0% 0%
說明:
設置對象的背景樣式。
如使用該復合屬性定義其單個參數,則其他參數的默認值將無條件覆蓋各自對應的單個屬性設置。
例如:設置 background : white 等於設置 background : white none repeat scroll 0% 0% 。如果在此之前設置了 background-image 屬性,則其設置將被 background-image 的默認值 none 覆蓋。
背景樣式屬性的作用區域為對象的內容區域與內補丁( padding )區域。不包括邊框( border )與外補丁( margin )區域。 儘管該屬性不可繼承,但如果未指定,其父對象的背景顏色和背景圖將在對像下面顯示。
對應的腳本特性為 background
示例:
div { background: red no-repeat scroll 5% 60%; }
body { background: url("images/aardvark.gif") repeat-y; }
pre { background: url("images/aardvark.gif") top; }
caption { background: fuchsia; }