CARVIEW |
Select Language
HTTP/2 200
content-type: text/html
x-guploader-uploadid: AAwnv3Ijb4aAUBn8V6GG6r7vAEF7AOte51I4HUyqyNJEPc1EMiHwRFrkqf4h8AeriRbwv0DJ
cache-control: public, max-age=3600
expires: Fri, 10 Oct 2025 05:06:49 GMT
last-modified: Fri, 10 Oct 2025 01:11:43 GMT
etag: W/"0ed32d0d48fb9b1d47bd41e72b824805"
x-goog-generation: 1760058703799874
x-goog-metageneration: 1
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 275399
x-goog-meta-goog-reserved-file-mtime: 1760056722
x-goog-hash: crc32c=NlLe/w==, md5=DtMtDUj7mx1HvUHnK4JIBQ==
x-goog-storage-class: STANDARD
accept-ranges: none
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
alt-svc: clear
referrer-policy: strict-origin-when-cross-origin
x-content-type-options: nosniff
strict-transport-security: max-age=63072000
content-security-policy: default-src 'self'; script-src 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; script-src-elem 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; style-src 'report-sample' 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self'; connect-src 'self' developer.allizom.org bcd.developer.allizom.org bcd.developer.mozilla.org updates.developer.allizom.org updates.developer.mozilla.org https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com https://incoming.telemetry.mozilla.org https://observatory-api.mdn.allizom.net https://observatory-api.mdn.mozilla.net https://api.github.com/search/issues stats.g.doubleclick.net https://api.stripe.com; font-src 'self'; frame-src 'self' interactive-examples.mdn.mozilla.net interactive-examples.mdn.allizom.net mdn.github.io live-samples.mdn.mozilla.net live-samples.mdn.allizom.net *.mdnplay.dev *.mdnyalp.dev *.play.test.mdn.allizom.net https://v2.scrimba.com https://scrimba.com jsfiddle.net www.youtube-nocookie.com codepen.io survey.alchemer.com https://js.stripe.com; img-src 'self' data: *.githubusercontent.com *.googleusercontent.com *.gravatar.com mozillausercontent.com firefoxusercontent.com profile.stage.mozaws.net profile.accounts.firefox.com developer.mozilla.org mdn.dev interactive-examples.mdn.mozilla.net interactive-examples.mdn.allizom.net wikipedia.org upload.wikimedia.org https://mdn.github.io/shared-assets/ https://mdn.dev/ https://*.google-analytics.com https://*.googletagmanager.com www.gstatic.com; manifest-src 'self'; media-src 'self' archive.org videos.cdn.mozilla.net https://mdn.github.io/shared-assets/; child-src 'self'; worker-src 'self';
x-frame-options: DENY
origin-trial: AxVILwizhbMjxFeHOn1P3R8niO1RJY/smaK4B4d1rLzc1gTaxtXMSaTi+FoigYgCw40uFRDwFcEAeqDR+vVLOW4AAABfeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb25WMiIsImV4cGlyeSI6MTc0MjA3OTYwMH0=
x-cloud-trace-context: 0e2f32db9ace7badbcbf786a5f4c1b56
date: Fri, 10 Oct 2025 04:06:49 GMT
server: Google Frontend
via: 1.1 google
vary: Accept-Encoding
content-encoding: gzip
x-cache: miss
:indeterminate - CSS: カスケーディングスタイルシート | MDN
Toggle sidebar
>
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
:indeterminate
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
:indeterminate
は CSS の擬似クラスセレクターで、未確定の状態にあるフォーム要素を表します。例えばチェックボックスで HTML の indeterminate
属性が true
に設定されたもの、ラジオボタンでグループ内がすべて選択されていないもの、 <progress>
要素で中間の状態などです。
css
/* 未確定の状態にある <input> をすべて選択 */
input:indeterminate {
background: lime;
}
このセレクターが対象とする要素は以下の通りです。
<input type="checkbox">
要素で、JavaScript によってindeterminate
プロパティがtrue
に設定されている場合<input type="radio">
要素で、フォーム内の同じname
の値を持つすべてのラジオボタンが未選択である場合<progress>
要素で、中間の状態の場合
構文
:indeterminate
例
>チェックボックスとラジオボタン
この例では中間の状態にあるフォームの要素に特殊なスタイルを適用します。
HTML
html
<fieldset>
<legend>Checkbox</legend>
<div>
<input type="checkbox" id="checkbox" />
<label for="checkbox">This checkbox label starts out lime.</label>
</div>
</fieldset>
<fieldset>
<legend>Radio</legend>
<div>
<input type="radio" id="radio1" name="radioButton" />
<label for="radio1">First radio label starts out lime.</label>
</div>
<div>
<input type="radio" id="radio2" name="radioButton" />
<label for="radio2">Second radio label also starts out lime.</label>
</div>
</fieldset>
CSS
css
input:indeterminate + label {
background: lime;
}
fieldset {
padding: 1em 0.75em;
}
fieldset:first-of-type {
margin-bottom: 1.5rem;
}
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;
}
結果
プログレスバー
HTML
html
<progress></progress>
CSS
css
progress {
margin: 4px;
}
progress:indeterminate {
width: 80vw;
height: 20px;
}
結果
仕様書
Specification |
---|
HTML> # selector-indeterminate> |
Selectors Level 4> # indeterminate-pseudo> |
ブラウザーの互換性
Loading…
関連情報
- ウェブフォーム — ユーザーデータでの作業
- ウェブフォームの整形
<input type="checkbox">
要素のindeterminate
属性<input>
およびそれを実装しているHTMLInputElement
インターフェイス:checked
セレクターは、チェックボックスがチェックされているかどうかでスタイル付けすることができます