語法:{background-position:數(shù)值|top|bottom|left|right|center} 作用:背景定位用于控制背景圖片在網(wǎng)頁中顯示的位置。 說明:參數(shù)取值范圍 ·帶長度單位的數(shù)字參數(shù) ·top:相對前景對象頂對齊 ·bottom:相對前景對象底對齊 ·left:相對前景對象左對齊 ·right:相對前景對象右對齊 ·center:相對前景對象中心對齊 ·比例關(guān)系 關(guān)鍵字解釋如下: top left = left top = 0% 0% top = top center = center top = 50% 0% right top = top right = 100% 0% left = left center = center left = 0% 50% center = center center = 50% 50% right = right center = center right = 100% 50% bottom left = left bottom = 0% 100% bottom = bottom center = center bottom = 50% 100% bottom right = right bottom = 100% 100% 注意:參數(shù)中的center如果用于另外一個參數(shù)的前面,表示水平居中;如果用于另外一個參數(shù)的后面,表示垂直居中。 6. 背景樣式:background
語法:{background:背景顏色|背景圖象|背景重復|背景附件|背景位置} 作用:背景屬性是一個更明確的背景—關(guān)系屬性的略寫。以下是一些背景的聲明: 例子: BODY { background: white url(http://www.htmlhelp.com/foo.gif) } BLOCKQUOTE { background: #7fffd4 } P { background: url(../backgrounds/pawn.png) #f0f8ff fixed } TABLE { background: #0c0 url(leaves.jpg) no-repeat bottom right } 注意:當一個值未被指定時,將接受其初始值。例如,在上述的前三條規(guī)則,背景位置屬性將被設(shè)置為0% 0%。為了避免與用戶的樣式表之間的沖突,背景和顏色應(yīng)該一起被指定。