From 5a7fe91e6431e51251e1c9e059f7bc54ac361fc8 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Mon, 3 Jan 2022 23:32:18 +0900 Subject: 2021/08/13 時点の英語版に同期 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/ja/web/css/_colon_autofill/index.md | 75 +++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/files/ja/web/css/_colon_autofill/index.md b/files/ja/web/css/_colon_autofill/index.md index 733b9665b2..cdfc137b70 100644 --- a/files/ja/web/css/_colon_autofill/index.md +++ b/files/ja/web/css/_colon_autofill/index.md @@ -1,33 +1,72 @@ --- -title: ':-webkit-autofill' +title: ':autofill' slug: Web/CSS/:autofill tags: - CSS - - Non-standard - - Reference + - 標準外 + - リファレンス - 擬似クラス -translation_of: Web/CSS/:-webkit-autofill +browser-compat: css.selectors.autofill +translation_of: Web/CSS/:autofill original_slug: Web/CSS/:-webkit-autofill --- -
{{CSSRef}}{{Non-standard_header}}
+{{CSSRef}} -

CSS の :-webkit-autofill 疑似クラスは、 {{HTMLElement("input")}} 要素の値がブラウザーによって自動補完されている時に一致します。

+**`:autofill`** は CSS の[擬似クラス](/ja/docs/Web/CSS/Pseudo-classes)で、 {{HTMLElement("input")}} 要素の値がブラウザーによって自動補完された時に一致します。このクラスはユーザーがフィールドを編集すると一致しなくなります。 -

メモ: 多くのブラウザーのユーザーエージェントスタイルシートでは、 :-webkit-autofill スタイル定義に !important を使用しており、 JavaScript によるハックで解決しない限り、ウェブページから上書きすることができません。

+> **Note:** 多くのブラウザーのユーザーエージェントスタイルシートでは、 `:-webkit-autofill` スタイル定義に `!important` を使用しており、 JavaScript によるハックで解決しない限り、ウェブページから上書きすることができません。例えば、 Chrome では内部スタイルシートで次のようになっています。 +> +> ```css +> background-color: rgb(232, 240, 254) !important; +> background-image: none !important; +> color: -internal-light-dark(black, white) !important; +> ``` +> +> これは、 {{cssxref('background-color')}}, {{cssxref('background-image')}}, {{cssxref('color')}} に独自のルールを設定できないことを意味します。 -

仕様書

+## 構文 -

どの仕様書でも定義されていません。

+```css +:autofill +``` -

ブラウザーの対応

+## 例 -

{{Compat("css.selectors.-webkit-autofill")}}

+次の例は、 `:autofill` 擬似クラスを使用して、ブラウザーによって自動補完されたテキストフィールドの境界線を変更することを示しています。ブラウザーの互換性を保つために、 `:-webkit-autofill` と `:autofill` の両方を使用してください。 -

関連情報

+```css +input { + border: 3px solid grey; + border-radius: 3px; +} - +input:-webkit-autofill { + border: 3px solid blue; +} +input:autofill { + border: 3px solid blue; +} +``` + +```html +
+ +
+``` + +{{EmbedLiveSample('Examples')}} + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- [Chromium issue 46543: Auto-filled input text box yellow background highlight cannot be turned off!](https://code.google.com/p/chromium/issues/detail?id=46543) +- [WebKit bug 66032: Allow site authors to override autofilled fields' colors.](https://bugs.webkit.org/show_bug.cgi?id=66032) +- [Mozilla bug 740979: implement `:-moz-autofill` pseudo-class on input elements with an autofilled value](https://bugzilla.mozilla.org/show_bug.cgi?id=740979) +- [new css4-ui features - more selectors](https://wiki.csswg.org/spec/css4-ui#more-selectors) -- cgit v1.2.3-54-g00ecf