Html 中的背景(background)

Html 中的背景(background)

background-color : transparent | color

注:

transparent默認值。背景色透明。

Color : 指定顏色。

background-imagenone | url(1.jpg)

注:(圖片與html文件同目錄)

 

background-repeatrepeat|no-repeat|repeat-x|repeat-y

注: (圖像小的時候比較明顯)

repeat 背景圖片在縱向和橫向上平鋪(默認值)

no-repeat背景圖片不平鋪

repeat-x 橫向平鋪

repeat-y 縱向平鋪

background-attachmentscroll | fixed

scroll 背景圖片隨對象內容滾動

fixed 背景圖像固定

 

background-postion left|center|right|top|center|bottom

background-postion: 30px 40px;   (x ,y) 水平,豎直

注意:

在做項目時,許多小DIV 公用同一張背景圖片,這時就是用到了

Background-position ,即每個DIV 調用不同的position



div元素不動。直接移動背景圖片實現公用同一張背景圖片的目的。


把背景圖片往下拉,屬性值向y 軸正方向變化

背景圖片往上拉。 屬性值向y 軸負方向變化

把背景圖片往左拉,屬性值向x軸負方向變化

把背景圖片往右拉,屬性值向x 軸正方向變化


Background 集中設置:

background:  gray  url()   no-repeat   500px  400px

body 也有背景的各種屬性。


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