css背景樣式

CSS 背景屬性

Property 描述
background

簡寫屬性,作用是將背景屬性設置在一個聲明中

body {background:#ffffff url('img_tree.png') no-repeat right top;}

background-attachment

背景圖像是否固定或者隨着頁面的其餘部分滾動。

scroll背景圖片隨頁面的其餘部分滾動。這是默認
fixed 背景圖像是固定的
inherit 指定background-attachment的設置應該從父元素繼承

background-color

設置元素的背景顏色

body {background-color:#b0c4de;}

background-image

把圖像設置爲背景

body
{
background-image:url('paper.gif');
}

background-position

設置背景圖像的起始位置

left top
left center
left bottom
right top
right center
right bottom
center top
center center
center bottom 如果僅指定一個關鍵字,其他值將會是"center"
x% y% 第一個值是水平位置,第二個值是垂直。左上角是0%0%。右下角是100%100%。如果僅指定了一個值,其他值將是50%。 。默認值爲:0%0%
xpos ypos 第一個值是水平位置,第二個值是垂直。左上角是0。單位可以是像素(0px0px)或任何其他 CSS單位。如果僅指定了一個值,其他值將是50%。你可以混合使用%和positions
inherit 指定background-position屬性設置應該從父元素繼承

background-repeat

設置背景圖像是否及如何重複

repeat 背景圖像將向垂直和水平方向重複。這是默認
repeat-x 只有水平位置會重複背景圖像
repeat-y 只有垂直位置會重複背景圖像
no-repeat background-image不會重複
inherit 指定background-repea屬性設置應該從父元素繼承


內容整理轉自:http://www.runoob.com/cssref/pr-background-image.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章