From 1d809ff11976fdf10d99173c9de268af1c9b0bcf Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Tue, 4 Jan 2022 00:34:12 +0900 Subject: 2021/10/06 時点の英語版に同期 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/ja/web/css/_colon_indeterminate/index.md | 200 +++++++++++++------------ 1 file changed, 102 insertions(+), 98 deletions(-) (limited to 'files/ja/web') diff --git a/files/ja/web/css/_colon_indeterminate/index.md b/files/ja/web/css/_colon_indeterminate/index.md index e2721b89a7..d90d4e90be 100644 --- a/files/ja/web/css/_colon_indeterminate/index.md +++ b/files/ja/web/css/_colon_indeterminate/index.md @@ -1,140 +1,144 @@ --- title: ':indeterminate' -slug: 'Web/CSS/:indeterminate' +slug: Web/CSS/:indeterminate tags: - ':indeterminate' - CSS - - Layout - - Pseudo-class - - Reference - - Selector - - Web + - レイアウト + - 擬似クラス + - リファレンス + - セレクター + - ウェブ - checkbox - progress - - radio button -translation_of: 'Web/CSS/:indeterminate' + - ラジオボタン +browser-compat: css.selectors.indeterminate +translation_of: Web/CSS/:indeterminate --- -
{{CSSRef}}
+{{CSSRef}} -

:indeterminateCSS擬似クラスセレクターで、未確定の状態にあるフォーム要素を表します。例えばチェックボックスで HTML の indeterminate 属性が true に設定されたもの、ラジオボタンでグループ内がすべて選択されていないもの、 {{HTMLElement("progress")}} 要素で中間の状態などです。

+**`:indeterminate`** は [CSS](/ja/docs/Web/CSS) の[擬似クラス](/ja/docs/Web/CSS/Pseudo-classes)セレクターで、未確定の状態にあるフォーム要素を表します。例えばチェックボックスで HTML の [`indeterminate`](/ja/docs/Web/HTML/Element/input/checkbox#indeterminate) 属性が `true` に設定されたもの、ラジオボタンでグループ内がすべて選択されていないもの、 {{HTMLElement("progress")}} 要素で中間の状態などです。 -
/* 中間の状態にある <input> をすべて選択 */
+```css
+/* 未確定の状態にある  をすべて選択 */
 input:indeterminate {
   background: lime;
-}
+} +``` -

このセレクターが対象とする要素は以下の通りです。

+このセレクターが対象とする要素は以下の通りです。 - +- [``](/ja/docs/Web/HTML/Element/input/checkbox) 要素で、[JavaScript](/ja/docs/Web/JavaScript) によって `indeterminate` プロパティが `true` に設定されている場合 +- [``](/ja/docs/Web/HTML/Element/input/radio) 要素で、フォーム内の同じ `name` の値を持つすべてのラジオボタンが未選択である場合 +- {{HTMLElement("progress")}} 要素で、中間の状態の場合 -

構文

+## 構文 {{csssyntax}} -

+## 例 + +### チェックボックスとラジオボタン -

チェックボックスとラジオボタン

+この例では中間の状態にあるフォームの要素に特殊なスタイルを適用します。 -

この例では中間の状態にあるフォームの要素に特殊なスタイルを適用します。

+#### HTML -

HTML

+```html +
+ Checkbox +
+ + +
+
-
<div>
-  <input type="checkbox" id="checkbox">
-  <label for="checkbox">背景が緑色になるはずです</label>
-</div>
-<div>
-  <input type="radio" id="radio">
-  <label for="radio">背景が緑色になるはずです</label>
-</div>
+
+ Radio +
+ + +
+
+ + +
+
+``` -

CSS

+#### CSS -
input:indeterminate + label {
+```css
+input:indeterminate + label {
   background: lime;
 }
-
+``` -

JavaScript

+```css hidden +fieldset { + padding: 1em 0.75em; +} -
var inputs = document.getElementsByTagName("input");
+fieldset:first-of-type {
+    margin-bottom: 1.5rem;
+}
 
-for (var i = 0; i < inputs.length; i++) {
+fieldset:not(:first-of-type) > div:not(:last-child) {
+    margin-bottom: 0.5rem;
+}
+```
+
+#### JavaScript
+
+```js
+const inputs = document.getElementsByTagName("input");
+
+for (let i = 0; i < inputs.length; i++) {
   inputs[i].indeterminate = true;
 }
-
+``` + +#### 結果 -

{{EmbedLiveSample('Checkbox_radio_button', 'auto', 50)}}

+{{EmbedLiveSample('Checkbox_radio_button', 'auto', 230)}} -

プログレスバー

+### プログレスバー -

HTML

+#### HTML -
<progress>
-
+```html + +``` -

CSS

+#### CSS -
progress {
+```css
+progress {
   margin: 4px;
 }
 
 progress:indeterminate {
-  opacity: 0.5;
-  background-color: lightgray;
-  box-shadow: 0 0 2px 1px red;
+  width:80vw;
+  height:20px;
 }
-
- -

結果

- -

{{EmbedLiveSample('Progress_bar', 'auto', 30)}}

- -

仕様書

- - - - - - - - - - - - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName('HTML WHATWG', '#selector-indeterminate', ':indeterminate')}}{{Spec2('HTML WHATWG')}}変更なし。
{{SpecName('HTML5 W3C', '#selector-indeterminate', ':indeterminate')}}{{Spec2('HTML5 W3C')}}HTML における意味論と制約検証の定義。
{{SpecName('CSS4 Selectors', '#indeterminate', ':indeterminate')}}{{Spec2('CSS4 Selectors')}}変更なし。
- -

ブラウザーの互換性

- -
-

{{Compat("css.selectors.indeterminate")}}

- -

関連情報

- - -
+``` + +#### 結果 + +{{EmbedLiveSample('Progress_bar', 'auto', 30)}} + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- [ウェブフォーム — ユーザーデータでの作業](/ja/docs/Learn/Forms) +- [ウェブフォームの整形](/ja/docs/Learn/Forms/Styling_web_forms) +- [``](/ja/docs/Web/HTML/Element/input/checkbox) 要素の [`indeterminate`](/ja/docs/Web/HTML/Element/input/checkbox#indeterminate) 属性 +- {{HTMLElement("input")}} およびそれを実装している {{domxref("HTMLInputElement")}} インターフェイス +- {{cssxref(":checked")}} セレクターは、チェックボックスがチェックされているかどうかでスタイル付けすることができます -- cgit v1.2.3-54-g00ecf