一般的な背景スタイル

2916 ワード

backgroundプロパティ
- background-color
色の設定には、次の3つの方法があります.
1,red,yellow,blue,pink,blackなどの英語の単語
background-color:red;

2,RGB(red,green,blue)は、赤、緑、青、すなわち三原色を表し、各取値範囲は0-255であり、色は淡から深までであり、DW上では自分の望む色を直接選択することができる.一方RGBA(red,green,blue,alpha)はこれに基づいて透明度が1つ増え,aの値範囲は0-1であり,完全透明から完全不透明に変化した.赤:rgb(255,0,0)緑:rgb(0255,0)青:rgb(0,0255)黒:rgb(0,0,0)白:rgb(255,255,255)
background-color:rgb(255,255,255)
background-color:rgba(255,255,255,1)

3,16進数,「#」で始まると本質的にRGBであり,2桁ごとに1色を表し,#ffffは実際にrgb(255,255,255)である.
background-color:#ffffff

- background-image
background-image:url(img/2,jpg)

- background-repeat
background-repeat:no-repeat /*   */
background-repeat:repeat-x /*x     */
background-repeat:repeat-y /*y     */

- background-position
background-position: 50% 30px
background-position: 100px 30px 

2つの値はそれぞれX,Y軸への移動距離を表す
background-position:right bottom 

2つの値はそれぞれX,Y軸の位置を表し,1番目の値はleft,center,right,2番目の値はtop,center,bottom,デフォルト値はcenterである.
background-repeat:repeat-x
background-position:center 0px

注意はX軸の真ん中から平らになりますが、左側に空白が残らず、揃えます.
- background-attachment
固定位置、ページをスクロールし、画像を動かさない.
background-attachment:fixed

注意:複合スタイルでは、すべてのプロパティをbackgroundで直接包むことができます.これは簡単です.