TOPCSS背景関連

背景関連

1.背景色 background-color
sample
#aka { background-color:#cc0000; }
#pink { background-color:#ffcc66; }
sample sample

背景色の指定
background-color : 色指定
background-color : transparent
※「transparent」は透明の指定、つまり親ボックスの背景が透けて見えます。

backtop
2.背景画像 background-image
sample

#gazou {
background-image:url("sample.gif");
background-color:#ffcc66;
}

sample sample

背景画像を指定
background-image : url("***.jpg")
background-image : none
※「none」は背景画像を指定しない場合に使用

backtop
3.背景画像繰り返し background-repeat
sample

#sample1 { backrground-repeat:no-repeat;}
#sample2 { backrground-repeat:repeat;}
#sample3 { backrground-repeat:repeat-x;}
#sample4 { backrground-repeat:repeat-y;}

sample sample

背景画像の繰り返し方法の指定
background-repeat : ***

no-repeat
繰り返し無し
repeat
縦横方向に繰り返し
repeat-x
横方向に繰り返し
repeat-y
縦方向に繰り返し
backtop
4.背景画像の固定 backrground-attachment
sample

#ugoku { background-attachment:scroll; }
#kotei { background-attachment:fixed; }

sample sample

背景画像を固定するか動かすかの指定
backrgound-attachment : ***

scroll
内容と共に背景画像がスクロールする
fixed
スクロールしても背景画像は動かず固定
backtop
5.背景画像の位置指定 background-position
sample

#sample1 { backrgound-position:right center; }
#sample2 { background-position:center bottom; }
#sample3 { background-position:30%; }
#sample4 { background-position:30px 40px; }

sample sample

背景画像の位置を指定(基点は左上)
background-position : 数値+単位 数値+単位

水平方向(横方向)と垂直方向(縦方向)を半角スペースで区切って指定します。 数字+単位を1つしか設定しなかった場合は、水平方向(横方向)を指定したことになり、垂直方向(縦方向)自動的に50%の指定となります。

background-position : *** ***
下記キーワードで指定することも可能

left
横平方向0%
right
横方向100%
top
縦方向0%
center
縦方向50%、もしくは横方向50%
bottom
縦方向100%
backtop
6.背景一括指定 background
sample

#matome { background: #ffcc66 url("sample.jpg") no-repeat fixed; }

sample sample

背景に関する設定を一括で指定
background : *** *** *** ・・・

background-color
background-image
background-repeat
background-attachment
background-position

それぞれの必要な値を「半角スペース」で区切って並べます。
順番は決まっていないので適当に。

※省略されたものは初期値が適用されます。

backtop
Search



Recommendation



Search

クリックお願いします!!

クリコレ@With 人気Webランキングsozai-R 素材専門検索0574 Web Site Ranking206

Search