ホーム HTML CSS XML JAVASCRIPT   PHP SQL MORE...   リファレンス 事例集    

CSS3 background プロパティ

CSS3 Reference 完全な CSS3 リファレンス

div へ複数の画像(および、その位置)を設定します element:

div
{
background:url(smiley.gif) top left no-repeat,
url(sqorange.gif) bottom left no-repeat,
url(sqgreen.gif) bottom right no-repeat;
}

Try it yourself »

ブラウザ・サポート

Internet Explorer Firefox Opera Google Chrome Safari

background プロパティは、主要なすべてのブラウザがサポートします。

注: IE8以前は、1つの要素に複数の背景画像はサポートしていません。


定義と用法

background ショートハンド・プロパティは、1回の宣言ですべての背景プロパティを設定します。

設定できるプロパティは次の通りです: background-color、 background-position、background-size、background-repeat、background-origin、 background-clip、background-attachment および background-image

上記値のうちの1つが欠けても問題ありません。例えば、background:#ff0000 url(smiley.gif); との指定が可能です。

デフォルト値: 各個別のプロパティ参照
継承: no
バージョン: CSS1 + CSS3 の新プロパティ
JavaScript構文: object.style.background="red url(smiley.gif) top left no-repeat"


構文

background: color position size repeat origin clip attachment image;

説明 CSS
background-color 使用する背景色を指定します 1
background-position 背景画像の位置を指定します 1
background-size 背景画像のサイズを指定します 3
background-repeat 背景画像をどのように繰り返すかを指定します 1
background-origin 背景画像の配置エリアを指定します 3
background-clip 背景画像のペイントエリアを指定します 3
background-attachment 背景画像を固定するか、またはページの残りの部分と一緒にスクロールするかを指定します 1
background-image 使用する1つ以上の背景画像を指定します 1


関連ページ

CSS3 チュートリアル: CSS3 Backgrounds


CSS3 Reference 完全な CSS3 リファレンス