---
title: '::-ms-clear'
slug: 'Archive/Web/CSS/::-ms-clear'
tags:
- CSS
- 'CSS:Microsoft Extensions'
- Non-standard
- Pseudo-element
- Reference
- Selector
translation_of: 'Archive/Web/CSS/::-ms-clear'
---
{{CSSRef}}{{Non-standard_Header}}
CSS の ::-ms-clear
擬似要素は、 {{HTMLElement("input/text", '<input type="text">
')}} テキストコントロールにの端に、現在の値をクリアするクリアボタンを生成します。この擬似要素は標準外であり、 Internet Explorer 10, Internet Explorer 11, Microsoft Edge のみが対応しています。
クリアボタンはフォーカスを与えられた、空ではないテキストコントロールにのみ表示されます。これにはテキスト風、または type="text"
へフォールバックされるものも含みます。そのような入力欄には次のようなものがあります。
- {{HTMLElement("input/color", '
<input type="color">
')}}
- {{HTMLElement("input/date", '
<input type="date">
')}}
- {{HTMLElement("input/datetime", '
<input type="datetime">
')}}
- {{HTMLElement("input/datetime-local", '
<input type="datetime-local">
')}}
- {{HTMLElement("input/email", '
<input type="email">
')}}
- {{HTMLElement("input/month", '
<input type="month">
')}}
- {{HTMLElement("input/number", '
<input type="number">
')}}
- {{HTMLElement("input/search", '
<input type="search">
')}}
- {{HTMLElement("input/tel", '
<input type="tel">
')}}
- {{HTMLElement("input/time", '
<input type="time">
')}}
- {{HTMLElement("input/url", '
<input type="url">
')}}
- {{HTMLElement("input/week", '
<input type="week">
')}}
許容されるプロパティ
以下の CSS プロパティのみが ::-ms-clear
がセレクターにある場合に利用できます。その他のプロパティは無視されます。
- {{CSSxRef("-ms-high-contrast-adjust")}}
- {{CSSxRef("background-clip")}}
- {{CSSxRef("background-color")}}
- {{CSSxRef("background-image")}}
- {{CSSxRef("background-origin")}}
- {{CSSxRef("background-position-x")}}
- {{CSSxRef("background-position-y")}}
- {{CSSxRef("background-repeat")}}
- {{CSSxRef("background-size")}}
- {{CSSxRef("border-bottom-color")}}
- {{CSSxRef("border-bottom-left-radius")}}
- {{CSSxRef("border-bottom-right-radius")}}
- {{CSSxRef("border-bottom-style")}}
- {{CSSxRef("border-bottom-width")}}
- {{CSSxRef("border-left-color")}}
- {{CSSxRef("border-left-style")}}
- {{CSSxRef("border-left-width")}}
- {{CSSxRef("border-right-color")}}
- {{CSSxRef("border-right-style ")}}
- {{CSSxRef("border-right-width")}}
- {{CSSxRef("border-top-color")}}
- {{CSSxRef("border-top-left-radius")}}
- {{CSSxRef("border-top-right-radius ")}}
- {{CSSxRef("border-top-style")}}
- {{CSSxRef("border-top-width")}}
- {{CSSxRef("box-shadow")}}
- {{CSSxRef("box-sizing")}}
- {{CSSxRef("color")}}
- {{CSSxRef("cursor")}}
- {{CSSxRef("display")}} (
block
, inline-block
, none
の値)
- {{CSSxRef("@font-face")}}
- {{CSSxRef("font-size")}}
- {{CSSxRef("font-style")}}
- {{CSSxRef("font-weight")}}
- {{CSSxRef("height")}}
- {{CSSxRef("margin-bottom")}}
- {{CSSxRef("margin-left")}}
- {{CSSxRef("margin-right")}}
- {{CSSxRef("margin-top")}}
- {{CSSxRef("opacity")}}
- {{CSSxRef("outline-color")}}
- {{CSSxRef("outline-style")}}
- {{CSSxRef("outline-width")}}
- {{CSSxRef("padding-bottom")}}
- {{CSSxRef("padding-left")}}
- {{CSSxRef("padding-right")}}
- {{CSSxRef("padding-top")}}
- {{CSSxRef("transform")}}
- {{CSSxRef("transform-origin")}}
- {{CSSxRef("visibility")}}
- {{CSSxRef("width")}}
構文
{{CSSSyntax}}
例
HTML
<form>
<label for="firstname">First name:</label>
<input type="text" id="firstname" name="firstname" placeholder="First name">
<br>
<label for="lastname">Last name:</label>
<input type="text" id="lastname" name="lastname" placeholder="Second name">
</form>
CSS
input,
label {
display: block;
}
input[type=text]::-ms-clear {
color: red; /* ×印の色を赤に設定します。 */
/* display 属性を "none" に設定することで、×印を非表示にすることができます。 */
}
結果
{{EmbedLiveSample('Example')}}
以下のスクリーンショットは、この機能がどのように見えるかを示しています。
![](https://mdn.mozillademos.org/files/12263/ms-clear-example.png)
仕様書
どの仕様書にも掲載されていません。
ブラウザーの互換性
過去には Internet Explorer と Edge のバージョン79より前で対応していました。