From 78a809cda8c0af756dfe71dafa14f9779fd1d7e8 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Thu, 29 Jul 2021 13:58:55 +0900 Subject: conflicting/Web/CSS/CSS_Backgrounds_and_Borders 以下を削除 (#1521) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 正規版に履歴を継承 --- files/ja/_redirects.txt | 22 ++--- files/ja/_wikihistory.json | 30 ++---- .../resizing_background_images/index.html | 104 --------------------- .../using_multiple_backgrounds/index.html | 75 --------------- 4 files changed, 21 insertions(+), 210 deletions(-) delete mode 100644 files/ja/conflicting/web/css/css_backgrounds_and_borders/resizing_background_images/index.html delete mode 100644 files/ja/conflicting/web/css/css_backgrounds_and_borders/using_multiple_backgrounds/index.html diff --git a/files/ja/_redirects.txt b/files/ja/_redirects.txt index c30bcf5c32..bbe05c0df0 100644 --- a/files/ja/_redirects.txt +++ b/files/ja/_redirects.txt @@ -357,14 +357,14 @@ /ja/docs/CSS/Media /ja/docs/Web/CSS/@media /ja/docs/CSS/Media/Visual /ja/docs/Web/CSS/@media /ja/docs/CSS/Media_queries /ja/docs/Web/CSS/Media_queries -/ja/docs/CSS/Multiple_backgrounds /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds +/ja/docs/CSS/Multiple_backgrounds /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds /ja/docs/CSS/Other_Resources /ja/docs/conflicting/Web/CSS_eb0c7d23f84df658710ebb6b4bdec8ea /ja/docs/CSS/Privacy_and_the_:visited_selector /ja/docs/Web/CSS/Privacy_and_the_:visited_selector /ja/docs/CSS/Pseudo-classes /ja/docs/Web/CSS/Pseudo-classes /ja/docs/CSS/Pseudo-elements /ja/docs/Web/CSS/Pseudo-elements /ja/docs/CSS/Pseudo-elements-redirect-1 /ja/docs/Web/CSS/Pseudo-elements /ja/docs/CSS/Replaced_element /ja/docs/Web/CSS/Replaced_element -/ja/docs/CSS/Scaling_background_images /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images +/ja/docs/CSS/Scaling_background_images /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images /ja/docs/CSS/Shorthand_properties /ja/docs/Web/CSS/Shorthand_properties /ja/docs/CSS/Specificity /ja/docs/Web/CSS/Specificity /ja/docs/CSS/Syntax /ja/docs/Web/CSS/Syntax @@ -372,7 +372,7 @@ /ja/docs/CSS/Tutorials/Using_CSS_animations /ja/docs/Web/CSS/CSS_Animations/Using_CSS_animations /ja/docs/CSS/Tutorials/Using_CSS_flexible_boxes /ja/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox /ja/docs/CSS/Tutorials/Using_CSS_gradients /ja/docs/Web/CSS/CSS_Images/Using_CSS_gradients -/ja/docs/CSS/Tutorials/Using_CSS_multiple_backgrounds /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds +/ja/docs/CSS/Tutorials/Using_CSS_multiple_backgrounds /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds /ja/docs/CSS/Tutorials/Using_CSS_transforms /ja/docs/Web/CSS/CSS_Transforms/Using_CSS_transforms /ja/docs/CSS/Tutorials/Using_CSS_transitions /ja/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions /ja/docs/CSS/Type_selectors /ja/docs/Web/CSS/Type_selectors @@ -391,7 +391,7 @@ /ja/docs/CSS/Using_CSS_flexible_boxes /ja/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox /ja/docs/CSS/Using_CSS_gradients /ja/docs/Web/CSS/CSS_Images/Using_CSS_gradients /ja/docs/CSS/Using_CSS_multi-column_layouts /ja/docs/Web/CSS/CSS_Columns/Using_multi-column_layouts -/ja/docs/CSS/Using_CSS_multiple_backgrounds /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds +/ja/docs/CSS/Using_CSS_multiple_backgrounds /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds /ja/docs/CSS/Using_CSS_transforms /ja/docs/Web/CSS/CSS_Transforms/Using_CSS_transforms /ja/docs/CSS/Using_CSS_transitions /ja/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions /ja/docs/CSS/Using_media_queries_from_code /ja/docs/Web/CSS/Media_Queries/Testing_media_queries @@ -602,7 +602,7 @@ /ja/docs/CSS/word-wrap /ja/docs/Web/CSS/overflow-wrap /ja/docs/CSS/writing-mode /ja/docs/Web/CSS/writing-mode /ja/docs/CSS/z-index /ja/docs/Web/CSS/z-index -/ja/docs/CSS/複数の背景 /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds +/ja/docs/CSS/複数の背景 /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds /ja/docs/CSS3_Columns /ja/docs/Web/CSS/CSS_Columns/Using_multi-column_layouts /ja/docs/CSS:-moz-appearance /ja/docs/Web/CSS/appearance /ja/docs/CSS:-moz-background-clip /ja/docs/Web/CSS/background-clip @@ -4136,7 +4136,7 @@ /ja/docs/Web/CSS/Background_Backup /ja/docs/Web/CSS/background /ja/docs/Web/CSS/Block_formatting_context /ja/docs/Web/Guide/CSS/Block_formatting_context /ja/docs/Web/CSS/CSS_Background_and_Borders /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders -/ja/docs/Web/CSS/CSS_Background_and_Borders/Using_CSS_multiple_backgrounds /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds +/ja/docs/Web/CSS/CSS_Background_and_Borders/Using_CSS_multiple_backgrounds /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Scaling_background_images /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images /ja/docs/Web/CSS/CSS_Colors /en-US/docs/Web/CSS/CSS_Color /ja/docs/Web/CSS/CSS_Flexible_Box_Layout/Advanced_layouts_with_flexbox /ja/docs/conflicting/Web/CSS/CSS_Flexible_Box_Layout/Backwards_Compatibility_of_Flexbox @@ -4187,7 +4187,7 @@ /ja/docs/Web/CSS/Reference/@viewport/user-zoom /ja/docs/Web/CSS/@viewport /ja/docs/Web/CSS/Reference/@viewport/zoom /ja/docs/Web/CSS/@viewport /ja/docs/Web/CSS/Reference/Mozilla_Extensions /ja/docs/Web/CSS/Mozilla_Extensions -/ja/docs/Web/CSS/Scaling_background_images /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images +/ja/docs/Web/CSS/Scaling_background_images /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images /ja/docs/Web/CSS/Understanding_z_index /ja/docs/Web/CSS/CSS_Positioning/Understanding_z_index /ja/docs/Web/CSS/Understanding_z_index/Adding_z-index /ja/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Adding_z-index /ja/docs/Web/CSS/Understanding_z_index/Stacking_and_float /ja/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Stacking_and_float @@ -4203,7 +4203,7 @@ /ja/docs/Web/CSS/Using_CSS_variables /ja/docs/Web/CSS/Using_CSS_custom_properties /ja/docs/Web/CSS/Using_media_queries_from_code /ja/docs/Web/CSS/Media_Queries/Testing_media_queries /ja/docs/Web/CSS/Using_multi-column_layouts /ja/docs/Web/CSS/CSS_Columns/Using_multi-column_layouts -/ja/docs/Web/CSS/Using_multiple_backgrounds /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds +/ja/docs/Web/CSS/Using_multiple_backgrounds /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds /ja/docs/Web/CSS/attr /ja/docs/Web/CSS/attr() /ja/docs/Web/CSS/aural /ja/docs/Web/CSS/@media/aural /ja/docs/Web/CSS/auto /ja/docs/Web/CSS/width @@ -4280,7 +4280,7 @@ /ja/docs/Web/CSS/var /ja/docs/Web/CSS/var() /ja/docs/Web/CSS/visible /ja/docs/Web/CSS/visibility /ja/docs/Web/CSS/word-wrap /ja/docs/Web/CSS/overflow-wrap -/ja/docs/Web/CSS/複数の背景 /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds +/ja/docs/Web/CSS/複数の背景 /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds /ja/docs/Web/Compatibility_FAQ /ja/docs/orphaned/Web/Compatibility_FAQ /ja/docs/Web/Compatibility_FAQ/Broken_Table_Layout.html /ja/docs/orphaned/Web/Compatibility_FAQ/Broken_Table_Layout.html /ja/docs/Web/Compatibility_FAQ/Cut_Off_Text.html /ja/docs/orphaned/Web/Compatibility_FAQ/Cut_Off_Text.html @@ -4377,7 +4377,7 @@ /ja/docs/Web/Guide/CSS/Getting_started/Why_use_CSS /en-US/docs/Learn/CSS/First_steps/How_CSS_works /ja/docs/Web/Guide/CSS/Getting_started/Why_use_CSS? /en-US/docs/Learn/CSS/First_steps/How_CSS_works /ja/docs/Web/Guide/CSS/Media_queries /ja/docs/conflicting/Web/CSS/Media_Queries/Using_media_queries -/ja/docs/Web/Guide/CSS/Scaling_background_images /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images +/ja/docs/Web/Guide/CSS/Scaling_background_images /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images /ja/docs/Web/Guide/CSS/Testing_media_queries /ja/docs/Web/CSS/Media_Queries/Testing_media_queries /ja/docs/Web/Guide/CSS/Understanding_z_index /ja/docs/Web/CSS/CSS_Positioning/Understanding_z_index /ja/docs/Web/Guide/CSS/Understanding_z_index/Adding_z-index /ja/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Adding_z-index @@ -4392,7 +4392,7 @@ /ja/docs/Web/Guide/CSS/Using_CSS_transforms /ja/docs/Web/CSS/CSS_Transforms/Using_CSS_transforms /ja/docs/Web/Guide/CSS/Using_CSS_transitions /ja/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions /ja/docs/Web/Guide/CSS/Using_multi-column_layouts /ja/docs/Web/CSS/CSS_Columns/Using_multi-column_layouts -/ja/docs/Web/Guide/CSS/Using_multiple_backgrounds /ja/docs/conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds +/ja/docs/Web/Guide/CSS/Using_multiple_backgrounds /ja/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds /ja/docs/Web/Guide/DOM /ja/docs/Web/API/Document_Object_Model /ja/docs/Web/Guide/DOM/Events/Touch_events /ja/docs/Web/API/Touch_events /ja/docs/Web/Guide/DOM/Events/Touch_events/Supporting_both_TouchEvent_and_MouseEvent /ja/docs/Web/API/Touch_events/Supporting_both_TouchEvent_and_MouseEvent diff --git a/files/ja/_wikihistory.json b/files/ja/_wikihistory.json index abded04456..a1ab8f2e0c 100644 --- a/files/ja/_wikihistory.json +++ b/files/ja/_wikihistory.json @@ -27919,13 +27919,21 @@ "Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images": { "modified": "2020-09-05T23:29:58.757Z", "contributors": [ - "mfuji09" + "mfuji09", + "mrstork", + "ethertank", + "sii" ] }, "Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds": { "modified": "2019-03-18T21:28:58.186Z", "contributors": [ - "sutara79" + "sutara79", + "tacamula", + "teoli", + "ethertank", + "Potappo", + "Piro" ] }, "Web/CSS/CSS_Basic_User_Interface": { @@ -48336,24 +48344,6 @@ "Marsf" ] }, - "conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images": { - "modified": "2019-03-23T23:37:28.021Z", - "contributors": [ - "mrstork", - "ethertank", - "sii" - ] - }, - "conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds": { - "modified": "2019-03-24T00:01:58.302Z", - "contributors": [ - "tacamula", - "teoli", - "ethertank", - "Potappo", - "Piro" - ] - }, "conflicting/Web/CSS/CSS_Basic_User_Interface/Using_URL_values_for_the_cursor_property": { "modified": "2019-03-23T23:49:29.579Z", "contributors": [ diff --git a/files/ja/conflicting/web/css/css_backgrounds_and_borders/resizing_background_images/index.html b/files/ja/conflicting/web/css/css_backgrounds_and_borders/resizing_background_images/index.html deleted file mode 100644 index f977767419..0000000000 --- a/files/ja/conflicting/web/css/css_backgrounds_and_borders/resizing_background_images/index.html +++ /dev/null @@ -1,104 +0,0 @@ ---- -title: 背景画像の拡大縮小 -slug: conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images -translation_of: Web/CSS/CSS_Backgrounds_and_Borders/Resizing_background_images -translation_of_original: Web/CSS/CSS_Background_and_Borders/Scaling_background_images -original_slug: Web/CSS/Scaling_background_images ---- -

CSS の {{cssxref("background-size")}} プロパティによって、フルサイズの画像がタイル状に配置されるという既定の動作の代わりに、背景画像のサイズを調節することができるようになります。画像を望むように拡大または縮小することができます。

- -

大きな画像をタイル状に配置する

- -

1233 × 1233 の大きな Firefox のロゴ画像を考えてみましょう。 300 × 300 四方に、この画像の 4 つのコピーをタイル状に配置したい(ぞっとするほど悪いサイトデザインを含むいくつかの理由で)場合、結果としてこうなります。

- -

screenshot1.png

- -

これは以下の CSS を使うことで達成されます。

- -
.square {
-  width: 300px;
-  height: 300px;
-  background-image: url(fxlogo.png);
-  border: solid 2px;
-  text-shadow: white 0px 0px 2px;
-  font-size: 16px;
-  background-size: 150px;
-}
-
- -

もし、とても古いブラウザをターゲットにするのであれば、いくつかの接頭辞を付したバージョンを加えることを考えるかもしれませんが、もう {{cssxref("background-size")}} に接頭辞を付すことは必要ありません。

- -

画像を引き伸ばす

- -

以下のように、画像の水平方向と垂直方向の両方のサイズを記述することもできます。

- -
background-size: 300px 150px;
-
- -

その結果はこのようになります。

- -

screenshot3.png

- -

画像を拡大する

- -

この範囲のもう 1 つの終端では、画像を背景の中で拡大することができます。 ここで、300 × 300 ピクセルに 16 × 16 ピクセルの favicon を拡大します。

- -

screenshot2.png

- -
.square2 {
-  width: 300px;
-  height: 300px;
-  background-image: url(favicon.png);
-  background-size: 300px;
-  border: solid 2px;
-  text-shadow: white 0px 0px 2px;
-  font-size: 16px;
-}
-
- -

ご覧のとおり、 CSS は実際には本質的に同一で、画像ファイル名は安全です。

- -

特別な値の「contain」と「cover」

- -

CSS の {{cssxref("background-size")}} には、 {{cssxref("<length>")}} の値の他に、 containcover の 2 つの特別なサイズの値が提示されています。これらについて見てみましょう。

- -

contain

- -

contain は、コンテナとなるボックスのサイズにかかわらず、背景画像は コンテナの対応する辺の長さを超えないように、可能な限り大きくなるようにそれぞれの辺を拡大縮小されるべきことを指定します。下記の実演中の例からこのことを確認するため、 Firefox 3.6 以降のような、背景画像の拡大縮小に対応したブラウザを使って、ウィンドウのサイズを変えてみて下さい。

- -
-

このウィンドウのサイズを変えて、何が起こるかを見て下さい。

-
- -

上の例の CSS は以下のようなものです。

- -
width: 100%;
-height: 200px;
-background-image: url(https://developer.mozilla.org/files/2917/fxlogo.png);
-background-size: contain;
-border: solid 2px;
-
- -

cover

- -

cover は、背景画像の両方の寸法が、コンテナの対応するサイズより大きくなる、または同じになることを確保しつつ、背景画像を可能な限り小さい大きさになるべきことを指定します。

- -
-

このウィンドウのサイズを変えて、何が起こるかを見て下さい。

-
- -

この例では以下の CSS を使用しています。

- -
width: 100%;
-height: 200px;
-background-image: url(https://developer.mozilla.org/files/2917/fxlogo.png);
-background-size: cover;
-border: solid 2px;
-
- -

関連情報

- - diff --git a/files/ja/conflicting/web/css/css_backgrounds_and_borders/using_multiple_backgrounds/index.html b/files/ja/conflicting/web/css/css_backgrounds_and_borders/using_multiple_backgrounds/index.html deleted file mode 100644 index 863b8661e9..0000000000 --- a/files/ja/conflicting/web/css/css_backgrounds_and_borders/using_multiple_backgrounds/index.html +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: CSS での複数の背景の利用方法 -slug: conflicting/Web/CSS/CSS_Backgrounds_and_Borders/Using_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 -original_slug: Web/CSS/CSS_Background_and_Borders/Using_CSS_multiple_backgrounds ---- -

{{CSSRef}}

- -

CSS3 より、要素に複数の背景を適用できるようになりました。複数の背景は、最初に指定した背景が最前面、最後に指定した背景が最も奥のレイヤーになるように、重ねて描画されます。

- -

複数の背景は、以下の様に各レイヤーをカンマで区切る事だけの簡単な構文で記述可能です。

- -
.myclass {
-  background: 背景1, 背景2, ..., 背景N;
-}
- -

この方法は、ショートハンドプロパティの {{cssxref("background")}} でも、{{cssxref("background-color")}} 以外の個別のプロパティ(※{{ cssxref("background-attachment") }}, {{ cssxref("background-clip") }}, {{ cssxref("background-image") }}, {{ cssxref("background-origin") }}, {{ cssxref("background-position") }}, {{ cssxref("background-repeat") }}, {{ cssxref("background-size") }}) のどちらでも利用可能です。

- -

- -

次の例では、上位レイヤーから

- -
    -
  1. Firefox のロゴ
  2. -
  3. 線形グラデーション
  4. -
  5. 花の画像
  6. -
- -

の順で、3 つの背景が重ねられています。記述量が多くなる場合は、例の様にカンマ毎に改行するとコードが読みやすくなるかもしれません。

- -
.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;
-}
- - - - - - - - - - -
スクリーンショット
css_multibg.png
- -

スクリーンショットで表示されているとおり、最初に記述した Firefox のアイコン画像が最前面、次にグラデーション、最後に花の画像が重ねて描画されます。 {{cssxref("background-repeat")}} と {{cssxref("background-position")}} に指定した複数の値は、それぞれ background-image で記述した各値に対し、同じ順番で適用されます。つまり、background-image の最初の値として指定した FireFox のアイコンの画像に対し、
- {{cssxref("background-repeat")}} は "bottom left"、
- {{cssxref("background-position")}} は "no-repeat"
- が適用され、その結果、Firefox のアイコンの画像は、最前面のレイヤーの右下にひとつだけ 表示されるのです。

- -

関連記事

- - -- cgit v1.2.3-54-g00ecf