diff options
| author | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:07:59 +0100 |
|---|---|---|
| committer | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:07:59 +0100 |
| commit | 6ef1fa4618e08426b874529619a66adbd3d1fcf0 (patch) | |
| tree | 890e3e27131be010d82ef957fa68db495006cb0e /files/ja/web/css/css_background_and_borders | |
| parent | 8260a606c143e6b55a467edf017a56bdcd6cba7e (diff) | |
| download | translated-content-6ef1fa4618e08426b874529619a66adbd3d1fcf0.tar.gz translated-content-6ef1fa4618e08426b874529619a66adbd3d1fcf0.tar.bz2 translated-content-6ef1fa4618e08426b874529619a66adbd3d1fcf0.zip | |
unslug ja: move
Diffstat (limited to 'files/ja/web/css/css_background_and_borders')
| -rw-r--r-- | files/ja/web/css/css_background_and_borders/using_css_multiple_backgrounds/index.html | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/files/ja/web/css/css_background_and_borders/using_css_multiple_backgrounds/index.html b/files/ja/web/css/css_background_and_borders/using_css_multiple_backgrounds/index.html deleted file mode 100644 index 4c7327f6c1..0000000000 --- a/files/ja/web/css/css_background_and_borders/using_css_multiple_backgrounds/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: CSS での複数の背景の利用方法 -slug: Web/CSS/CSS_Background_and_Borders/Using_CSS_multiple_backgrounds -tags: - - CSS - - CSS Background - - Example - - Guide - - Intermediate -translation_of: Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds -translation_of_original: Web/CSS/CSS_Background_and_Borders/Using_CSS_multiple_backgrounds ---- -<p id="Summary">{{CSSRef}}</p> - -<p>CSS3 より、要素に複数の背景を適用できるようになりました。複数の背景は、最初に指定した背景が最前面、最後に指定した背景が最も奥のレイヤーになるように、重ねて描画されます。</p> - -<p>複数の背景は、以下の様に各レイヤーをカンマで区切る事だけの簡単な構文で記述可能です。</p> - -<pre class="syntaxbox">.myclass { - background: 背景1, 背景2, ..., 背景N; -}</pre> - -<p>この方法は、ショートハンドプロパティの {{cssxref("background")}} でも、{{cssxref("background-color")}} 以外の個別のプロパティ(※{{ cssxref("background-attachment") }}, {{ cssxref("background-clip") }},<code> </code>{{ cssxref("background-image") }}, {{ cssxref("background-origin") }}, {{ cssxref("background-position") }}, {{ cssxref("background-repeat") }}, {{ cssxref("background-size") }}) のどちらでも利用可能です。</p> - -<h2 id="Example" name="Example">例</h2> - -<p>次の例では、上位レイヤーから</p> - -<ol> - <li>Firefox のロゴ</li> - <li><a href="/ja/CSS/linear-gradient" title="linear-gradient">線形グラデーション</a></li> - <li>花の画像</li> -</ol> - -<p>の順で、3 つの背景が重ねられています。記述量が多くなる場合は、例の様にカンマ毎に改行するとコードが読みやすくなるかもしれません。</p> - -<pre class="brush: css">.multi_bg_example { - background-image: - url("http://demos.hacks.mozilla.org/openweb/resources/images/logos/firefox-48.png"), /* 最前面の背景レイヤーの背景画像 */ - linear-gradient( to right, rgba(255,255,255,0), #fff ), - url("http://demos.hacks.mozilla.org/openweb/resources/images/patterns/flowers-pattern.jpg"); - - background-repeat: - no-repeat, /* 最前面の背景レイヤーに対応 */ - no-repeat, - repeat; - - background-position: - bottom right, /* 最前面の背景レイヤーに対応 */ - left, - right; -}</pre> - -<table class="standard-table"> - <tbody> - <tr> - <td class="header">スクリーンショット</td> - </tr> - <tr> - <td><img alt="css_multibg.png" src="/@api/deki/files/4028/=css_multibg.png"></td> - </tr> - </tbody> -</table> - -<p>スクリーンショットで表示されているとおり、最初に記述した Firefox のアイコン画像が最前面、次にグラデーション、最後に花の画像が重ねて描画されます。 {{cssxref("background-repeat")}} と {{cssxref("background-position")}} に指定した複数の値は、それぞれ <code>background-image</code> で記述した各値に対し、同じ順番で適用されます。つまり、<code>background-image</code> の最初の値として指定した FireFox のアイコンの画像に対し、<br> - {{cssxref("background-repeat")}} は "<code>bottom left</code>"、<br> - {{cssxref("background-position")}} は "<code>no-repeat</code>"<br> - が適用され、その結果、Firefox のアイコンの画像は、最前面のレイヤーの<em>右下に</em>、<em>ひとつだけ</em> 表示されるのです。</p> - -<h2 id="See_also" name="See_also">関連記事</h2> - -<ul> - <li><a href="/ja/docs/CSS/Using_CSS_gradients" title="グラデーションの利用">グラデーションの利用</a></li> -</ul> |
