Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

:-ms-input-placeholder pseudo-class

Applies one or more styles to placeholder text in an input element.

Internet Explorer 10



selector:-ms-input-placeholder {...}



A CSS simple selector.


By default, placeholder text in input fields is light gray, but the :-ms-input-placeholder pseudo-class selector enables you to style it however you want.


The following example highlights the street and ZIP code fields with a custom style. The placeholder text is displayed with the specified style until the field has focus, meaning that the field can be typed into. When the field has focus, it returns to the normal style of the input field and the placeholder text disappears.

<!DOCTYPE html>
  <title>Placeholder style example</title>
  <style type="text/css">
  input {
  /* placeholder only style */   
  input.address:-ms-input-placeholder {
    color: red;
    background-color: yellow;
  <form id="test">
    <p><label>Enter Name: <input id="name" placeholder="Your Name"/></label></p>
    <p><label>Enter Street: <input id="street" placeholder="Your address" /></label></p>
    <p><label>Enter a zip code: <input type="num" pattern="(0-9){5}" title="5 digit zip" id="zip" class="address" placeholder="5 digit zip" /></label></p>
    <input type="submit" />

You can view this page. (Internet Explorer 10 is required for this page to render correctly.)

See also

HTML5 Forms (Internet Explorer 10 Guide for Developers)
placeholder attribute



© 2017 Microsoft