aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasahiro FUJIMOTO <mfujimot@gmail.com>2022-01-03 12:36:40 +0900
committerMasahiro FUJIMOTO <mfujimot@gmail.com>2022-01-10 11:20:52 +0900
commit3bd2e21967a0a738d337e14afa5b1dae21314170 (patch)
treebca6b7a92868942951e97aaff4dd574426374e6e
parent56b34e61d9c06614029fc69f3c1fdd4da3c73f71 (diff)
downloadtranslated-content-3bd2e21967a0a738d337e14afa5b1dae21314170.tar.gz
translated-content-3bd2e21967a0a738d337e14afa5b1dae21314170.tar.bz2
translated-content-3bd2e21967a0a738d337e14afa5b1dae21314170.zip
2021/08/13 時点の英語版に同期
-rw-r--r--files/ja/web/css/_doublecolon_selection/index.md132
1 files changed, 55 insertions, 77 deletions
diff --git a/files/ja/web/css/_doublecolon_selection/index.md b/files/ja/web/css/_doublecolon_selection/index.md
index 08e101b907..f77a59d8fa 100644
--- a/files/ja/web/css/_doublecolon_selection/index.md
+++ b/files/ja/web/css/_doublecolon_selection/index.md
@@ -1,60 +1,59 @@
---
title: '::selection'
-slug: 'Web/CSS/::selection'
+slug: Web/CSS/::selection
tags:
- CSS
- - Experimental
- - リファレンス
- レイアウト
- - 疑似要素
-translation_of: 'Web/CSS/::selection'
+ - 擬似要素
+ - リファレンス
+ - セレクター
+browser-compat: css.selectors.selection
+translation_of: Web/CSS/::selection
---
-<div>{{CSSRef}}</div>
+{{CSSRef}}
-<p><span class="seoSummary"><a href="/ja/docs/Web/CSS">CSS</a> の <strong><code>::selection</code></strong> <a href="/ja/docs/Web/CSS/Pseudo-elements">擬似要素</a>は、ユーザーが (テキストをマウスでクリックやドラッグすることで) 選択した文書の一部にスタイルを適用します。</span></p>
+**`::selection`** は CSS の[擬似要素](/ja/docs/Web/CSS/Pseudo-elements)で、ユーザーが (テキストをマウスでクリックやドラッグすることで) 選択した文書の一部にスタイルを適用します。
-<pre class="brush: css no-line-numbers notranslate">::selection {
+```css
+::selection {
background-color: cyan;
-}</pre>
+}
+```
-<h2 id="Allowable_properties" name="Allowable_properties">利用できるプロパティ</h2>
+## 利用できるプロパティ
-<p><code>::selection</code> 擬似要素では、特定の CSS プロパティのみが利用できます。</p>
+`::selection` 擬似要素では、特定の CSS プロパティのみが利用できます。
-<ul>
- <li>{{CSSxRef("color")}}</li>
- <li>{{CSSxRef("background-color")}}</li>
- <li>{{CSSxRef("cursor")}}</li>
- <li>{{CSSxRef("caret-color")}}</li>
- <li>{{CSSxRef("outline")}} およびその個別指定プロパティ</li>
- <li>{{CSSxRef("text-decoration")}} および関連プロパティ</li>
- <li>{{CSSxRef("text-emphasis-color")}}</li>
- <li>{{CSSxRef("text-shadow")}}</li>
-</ul>
+- {{CSSxRef("color")}}
+- {{CSSxRef("background-color")}}
+- {{CSSxRef("text-decoration")}} および関連プロパティ
+- {{CSSxRef("text-shadow")}}
+- {{SVGAttr("stroke-color")}}, {{SVGAttr("fill-color")}}, {{SVGAttr("stroke-width")}}
-<div class="warning">
-<p>特に、 {{CSSxRef("background-image")}} は無視されます。</p>
-</div>
+特に、 {{CSSxRef("background-image")}} は無視されます。
-<h2 id="Syntax" name="Syntax">構文</h2>
+## 構文
-<pre class="syntaxbox notranslate">/* 従来の Firefox の構文 (バージョン 61 以前) */
+```css
+/* 従来の Firefox の構文 (バージョン 61 以前) */
::-moz-selection
{{CSSSyntax}}
-</pre>
+```
-<h2 id="Examples" name="Examples">例</h2>
+## 例
-<h3 id="HTML">HTML</h3>
+### HTML
-<pre class="brush: html notranslate">この文字列は選択すると特殊なスタイルになります。
-&lt;p&gt;こちらの段落も文字列を選択してみてください。&lt;/p&gt;</pre>
+```html
+この文字列は選択すると特殊なスタイルになります。
+<p>こちらの段落も文字列を選択してみてください。</p>
+```
-<h3 id="CSS">CSS</h3>
+### CSS
-<div class="hidden">
-<pre class="brush: css notranslate">::-moz-selection {
+```css hidden
+::-moz-selection {
color: gold;
background-color: red;
}
@@ -62,10 +61,11 @@ translation_of: 'Web/CSS/::selection'
p::-moz-selection {
color: white;
background-color: blue;
-}</pre>
-</div>
+}
+```
-<pre class="brush: css notranslate">/* 選択されたテキストを赤の背景に金色とする */
+```css
+/* 選択されたテキストを赤の背景に金色とする */
::selection {
color: gold;
background-color: red;
@@ -75,57 +75,35 @@ p::-moz-selection {
p::selection {
color: white;
background-color: blue;
-}</pre>
+}
+```
-<h3 id="Result" name="Result">結果</h3>
+### 結果
-<p>{{EmbedLiveSample('Examples')}}</p>
+{{EmbedLiveSample('Examples')}}
-<h2 id="Accessibility_concerns" name="Accessibility_concerns">アクセシビリティの考慮</h2>
+## アクセシビリティの考慮
-<p><strong>純粋に美的な理由により、選択されたテキストのスタイルを上書きしないでください。</strong> — ユーザーは必要に応じてカスタマイズすることができます。認知の問題を抱えている人や、技術的な知識に弱い人にとって、予期せず選択のスタイルが変更されると、機能の理解が妨げられる可能性があります。</p>
+**純粋に美的な理由により、選択されたテキストのスタイルを上書きしないでください。** — ユーザーは必要に応じてカスタマイズすることができます。認知の問題を抱えている人や、技術的な知識に弱い人にとって、予期せず選択のスタイルが変更されると、機能の理解が妨げられる可能性があります。
-<p>上書きする場合は、選択部分のテキストと背景の色の<strong>コントラスト比</strong>が、弱視の人でも読める程度に高いことを確認することが重要です。</p>
+上書きする場合は、選択部分のテキストと背景の色の**コントラスト比**が、弱視の人でも読める程度に高いことを確認することが重要です。
-<p>色のコントラスト比は、プレイスホルダーの文字列と入力欄の背景色の値とを比較することで決定されます。現在の<a href="https://www.w3.org/WAI/intro/wcag">ウェブコンテンツアクセシビリティガイドライン (Web Content Accessibility Guidelines, WCAG)</a> によれば、文字列コンテンツで <strong>4.5:1</strong> 以上、見出しのような大きめの文字列で 3:1 以上のコントラスト比が求められています。 (WCAG は、大きめの文字列とは、<a href="/ja/docs/Web/CSS/font-weight">太字</a>ならば <code>18.66px</code> 以上、または <code>24px</code> 以上と定義しています。)</p>
+色のコントラスト比は、プレイスホルダーの文字列と入力欄の背景色の値とを比較することで決定されます。現在の[ウェブコンテンツアクセシビリティガイドライン (Web Content Accessibility Guidelines, WCAG)](https://www.w3.org/WAI/intro/wcag) によれば、文字列コンテンツで **4.5:1** 以上、見出しのような大きめの文字列で 3:1 以上のコントラスト比が求められています。 (WCAG は、大きめの文字列とは、[太字](/ja/docs/Web/CSS/font-weight)ならば `18.66px` 以上、または `24px` 以上と定義しています。)
-<ul>
- <li><a href="https://webaim.org/resources/contrastchecker/">WebAIM: Color Contrast Checker</a></li>
- <li><a href="/ja/docs/Web/Accessibility/Understanding_WCAG/Perceivable#Guideline_1.4_Make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background">MDN "WCAG を理解する ― ガイドライン 1.4 の解説"</a></li>
- <li><a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html">Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0</a></li>
-</ul>
+- [WebAIM: Color Contrast Checker](https://webaim.org/resources/contrastchecker/)
+- [MDN "WCAG を理解する ― ガイドライン 1.4 の解説"](/ja/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background)
+- [Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html)
-<h2 id="Specifications" name="Specifications">仕様書</h2>
+## 仕様書
-<table class="standard-table">
- <thead>
- <tr>
- <th scope="col">仕様書</th>
- <th scope="col">状態</th>
- <th scope="col">備考</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{SpecName('CSS4 Pseudo-Elements', '#selectordef-selection', '::selection')}}</td>
- <td>{{Spec2('CSS4 Pseudo-Elements')}}</td>
- <td>初回定義。</td>
- </tr>
- </tbody>
-</table>
+{{Specifications}}
-<div class="note">
-<p><strong>注:</strong> <code>::selection</code> は CSS Selectors Level 3 の草稿にはありましたが、 (特に要素がネストされた場合の) 振る舞いの仕様化が途中であることや相互運用性が確保されなかったこと <a class="external" href="http://lists.w3.org/Archives/Public/www-style/2008Oct/0268.html">(W3C Style mailing list での議論に基づく)</a> から、勧告の過程で削除されました。これは <a href="http://dev.w3.org/csswg/css-pseudo-4/">Pseudo-Elements Level 4</a> で再導入されています。</p>
-</div>
+> **Note:** `::selection` は CSS Selectors Level 3 の草稿にはありましたが、 (特に要素がネストされた場合の) 動作の仕様化が途中であることや相互運用性が確保されなかったこと [(W3C Style mailing list での議論に基づく)](https://lists.w3.org/Archives/Public/www-style/2008Oct/0268.html)から、勧告の過程で削除されました。これは [Pseudo-Elements Level 4](https://dev.w3.org/csswg/css-pseudo-4/) で再導入されています。
-<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+## ブラウザーの互換性
-<p>{{Compat("css.selectors.selection")}}</p>
+{{Compat}}
-<h2 id="See_also" name="See_also">関連情報</h2>
+## 関連情報
-<ul>
- <li>
- <p>{{cssxref("pointer-events")}} - 要素でどのイベントが有効かを制御する</p>
- </li>
-</ul>
+- {{cssxref("pointer-events")}} - 要素でどのイベントが有効かを制御する