CSS之背景設定background

2021-09-26 07:45:44 字數 1026 閱讀 9649

1、background-color的六種表示方法:

⑴、background-color:rgb(0255,0255,0~255):rgb表示 紅 綠 藍

⑵、background-color:rgba(0255,0255,0255,01):rgb表示 紅 綠 藍 ,最後乙個表示透明度。

⑶、background-color:#ababab:十六進製制表示

⑷、hsl(0360,0100%,0~100%):hsl 表示 色調,飽和度,明度。

⑸、hsla(0360,0100%,0100%,01):hsl 表示 色調,飽和度,明度,a表示透明度。

⑹、預定義顏色:

3、background-repeat:設定背景是否重複。

⑴、background-repeat:no-repeat:不重複。

⑵、background-repeat:repeat-x:在x軸重複。

⑶、background-repeat:repeat-y:在y軸重複

4、backgroud-position:設定位置。

⑴、background-position:xpx ypx:以body內容左上角為原點,xy定位的左上角出現的位置,px也可用%表示,預設為0% 0%

⑵、background-position:left:放置在左邊

⑶、background-position:right:放置在右邊

⑷、background-position:center:放置在中間

⑸、background-position:top:放置在頂端

⑹、background-position:bottom:放置在底端

注意:以body左上角為原點的座標系,右下區域為正數區間!

6、background-size:設定尺寸大小。

⑴、background-size:x y:設定長x為多少,寬y為多少,可用%表示。

⑵、background-size:cover:鋪滿整個顯示區域。

⑶、background-size:contain:盡量讓原圖顯示在容器中。

css背景設定

顏色表示方法 background 1 red 英文單詞 2 ff0000 16進製制 3 rgb 255,0,0 3元色 4 rgb 100 0 0 百分比 背景起始位置 background origin padding box border box content box 邊框起始 內邊距起始...

css背景設定

1 background color 背景顏色 2 background image 背景 3 background repeat 背景重複 4 background position 背景位置 5 background size 背景尺寸 6 background attachment 背景粘附 ...

css背景設定

注 所有的 都在中實現 背景色 background color 顏色 背景 背景大小 background size 平鋪 重複 background repeat no repeat 此行表示不平鋪 背景位置 background position 傳值 x y xy可正可負 傳關鍵字 x ce...