accent-color
試してみましょう
現在 accent-color
に対応しているブラウザーは、以下の HTML 要素に適用します。
構文
css
/* キーワード値 */
accent-color: auto;
/* <color> 値 */
accent-color: red;
accent-color: #5729e9;
accent-color: rgb(0, 200, 0);
accent-color: hsl(228, 4%, 24%);
/* グローバル値 */
accent-color: inherit;
accent-color: initial;
accent-color: revert;
accent-color: unset;
値
auto
-
UA が選択した色を表します。プラットフォームの強調色がある場合は、それと一致します。
<color>
-
強調色として使用される色を指定します。
公式定義
形式文法
例
独自の強調色を設定
HTML
html
<input type="checkbox" checked />
<input type="checkbox" class="custom" checked />
CSS
css
input {
accent-color: auto;
display: block;
width: 30px;
height: 30px;
}
input.custom {
accent-color: rebeccapurple;
}
結果
仕様書
Specification |
---|
CSS Basic User Interface Module Level 4 # widget-accent |
ブラウザーの互換性
BCD tables only load in the browser
関連情報
<input>
要素- CSS を使った HTML の要素への色の適用
<color>
データ型- その他の色に関するプロパティ:
color
,background-color
,border-color
,outline-color
,text-decoration-color
,text-emphasis-color
,text-shadow
,caret-color
,column-rule-color