div+css屬性各個屬性詳解2

來源:互聯網
上載者:User

顏色與映像屬性

color

功能:設定前景或元素的顏色。
數值:使用顏色關鍵字或RGB值。

background-color

功能:設定頁面或頁面元素的背景顏色。
數值:
顏色 - 可用顏色名或RGB值
transparent - 透明,使頁面背景為預設背景。

background-image

功能:定義背景圖形。
數值:
none - 不用圖形作背景
url - 提供圖形檔案的URL地址
說明:也可以包括background-color屬性以便在找不到圖形時代用

background-repeat

功能:控製圖形背景是否重複排列。
數值:
repeat - 垂直和水平重複,預設值
repeat-x - 水平重複
repeat-y - 垂直重複
no-repeat - 不重複
說明:這個屬性和 background-image 和 background-position 屬性一起使用。

background-attachment

功能:指定元素的背景是隨元素一起滾動還是固定在頁面某個位置上。
數值:
scroll - 隨元素一起滾動
fixed - 固定
說明:
預設值是 scroll,這個屬性和 background-image 屬性一起使用。

background-position

功能:用於在空間中定位元素背景
數值:
長度 - 相對或絕對單位設定元素框邊緣的起點,並給出單位下的座標。
百分比 - 用百分比表示框邊緣上瀏覽器開始放圖的位置。可以重複這個值也提供垂直和水平起點
垂直位置 - 設定豎直方向的起點,關鍵字為 top, center, bottom
水平位置 - 設定水平方向的起點,關鍵字 left, center, right
例如:top left, left top和0% 0% 都表示圖形左上方從元素框左上方開始

background

功能:簡寫屬性,可以設定所有背景屬性。
數值:
background-attachment
background-color
background-image
background-position
background-repeat
有關上述數值的細節,見各個屬性部分。

display

功能:改變元素的顯示值,可以將元素類型線上,塊和清單項目相互變換。
數值:
none - 不顯示元素
block - 塊顯示,在元素前後設定分行符
inline - 刪除元素前後的分行符,使其併入其它元素流中
list-item - 將元素設定為清單中的一行
說明:可用 display 屬性值產生插入標題和補加清單或讓圖形變成線上顯示。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.