css背景
-
背景顏色
-
banckground-clor屬性定義元素的背景顏色
-
background-color:顏色值; -
一般情況下元素的背景顏色默認值是transparent(透明的)
-
-
背景圖片
-
background-image屬性描述了元素的背景影像,實際開發常見于LOGO或者一些裝飾性的小圖片或者超大的背景圖片,優點是非常便于控制位置
-
background-image:none|url(url)引數值 作用 none 無背景圖片 url 使用絕對 或者相對地址指定圖片
-
-
背景平鋪
-
使用background-repeat屬性設定
-
background-repeat:repeat|no-repeat|repeat-x|repeat-y;引數值 作用 repeat 平鋪 no-repeat 不平鋪 repeat-x 沿著x軸平鋪 repeat-y 沿著y軸平鋪
-
-
背景圖片位置
-
background-position屬性可以改變圖片在背景中的位置
-
background-position:x y;引數值 說明 length 百分數|由浮點數字和單位識別符號組成的長度 position top|center|bottom|left|center|right 方位名詞 -
引數是方位名詞
- 如果指定的兩個值都是方位名詞,則兩個值前后順序無關,比如left top 和top left效果一致
-
引數是精確單位
- 如果引數值是精確坐標,那么第一個肯定是x坐標,第二個肯定是Y坐標
-
混合單位
- 如果指定的兩個值是精確單位和方位名詞混合使用,則第一個值是x坐標,第二個值是Y坐標
-
-
背景影像固定(北京附著)
-
background-altachment屬性設定背景影像是否固定或者隨著頁面的其余部分滾動
-
background-altachment:scroll|fixed引數 作用 scroll 背景影像隨著物件內容滾動 fixed 背景影像固定
-
-
背景屬性的復合寫法
-
background:背景顏色 背景圖片位置 背景平鋪 背景圖片位置
-
-
背景色半透明
-
background:rgba(0,0,0,0.3) -
最后一個alpha透明度,取值范圍在0~1之間
-
| 屬性 | 作用 | 值 |
|---|---|---|
| background-color | 背景顏色 | 預定義的顏色值、十六進制、RGB代碼 |
| background-image | 背景圖片 | url(圖片路徑) |
| background-repeat | 是否平鋪 | repeat、no-repeat、repeat-x、repeat-y |
| background-position | 背景位置 | |
| background-altachment | 背景附著 | scroll(背景滾動)、fixed(背景固定) |
| 背景簡寫 | 書寫更簡單 | 背景顏色 背景圖片位置 背景平鋪 背景圖片位置 |
| 背景半透明 | 背景顏色半透明 | background:rgba(0,0,0,.3 ) |
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/111852.html
標籤:Html/Css
