CSS如何獲取想要顏色以及背景視覺差的實現

2021-10-03 10:43:05 字數 1174 閱讀 3260

提到css,顏色的設定大家經常都會為了設定合適的顏色屬性,而煞費苦心,今天總結一下css顏色的設定,以及怎麼快速提取出想要的顏色

1.css中的顏色表示法

1.單詞表示法

background color:背景顏色 red blue green…

2.16進製表示法

#000000–#ffffff

3.rgb三原色表示法

rgb(255,255,255);

取值範圍0-255

紅綠藍三原色法

例:

這是乙個塊

"width: 200px;height: 150px;background-color: #00000f;">

這也是乙個塊

2.css中的背景樣式

background-color:背景顏色

background-image: 背景 url(背景位址),缺省會水平垂直都鋪滿背景圖

background-repeat:背景的平鋪方式 repeat-x x軸線平鋪 repeat-y repeat(x,y)(x,y 都進行平鋪。預設值) no-repeat 都不平鋪

background-position: 背景的位置 :x y 移動(預設在左上角)

可以使用數字的樣式:

background-position: 100px 50px;

也可以使用單詞的樣式

x:left,center,right

y: top,center,bottom

background-position: right bottom;

也可以按照百分比的樣式

background-attachment:背景圖隨滾動條的移動方式

scroll : 預設值 隨瀏覽器移動而移動(背景位置是按照當前元素進行移動的)

fixed : 固定,不隨滾動條移動(背景位置是按照瀏覽器進行偏移的)

例:

body

div

視覺差的實現:

利用:background-attachment:背景圖隨滾動條的移動方式

例:

#div1

#div2

#div3

CSS顏色和背景屬性

一 介紹 1 backgroundcolor屬性 backgroundcolor屬性用於設定或檢索物件的背景顏色。其對應的樣式標籤屬性為background color屬性。語法 background color color 說明 在style物件中,樣式屬性與樣式標籤屬性的語法中的引數型別基本相同...

css基礎 背景與顏色

顏色 color rrggbb 紅色 ff0000 綠色 00ff00 藍色 0000ff 00f黑色 000000 000白色 ffffff fff color rgb 255,0,0 紅色 rgb 255,0,0 綠色 rgb 0,255,0 藍色 rgb 0,0,255 黑色 rgb 0,0,...

CSS背景以及文字

css設定背景 css設定文字 padding內邊距 text indent 4em 首行縮排,可以為負數 也可以是百分數,縮排父元素的 數 p p.flower p.中間不能有空格 p.flower 文字間隔 h4預設值 none 對文字不做任何改動,將使用源文件中的原有大小寫。顧名思義,uppe...