This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.


The non-standard proprietary :-ms-input-placeholder pseudo-class represents the placeholder text of a form element. This allows web developers and theme designers to customize the appearance of placeholder text. This pseudo-class is only supported by Internet Explorer and Microsoft Edge.


The following example highlights the Branch and ID 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.


<form id="test"> 
  <p><label>Enter Student Name: <input id="name" placeholder="Student Name"/></label></p>
  <p><label>Enter Student Branch: <input id="branch" placeholder="Student Branch" /></label></p>
  <p><label>Enter Student ID: <input type="num" pattern="[0-9]{8}" title="8 digit ID" id="sid" class="studentid" placeholder="8 digit id" /></label></p> 
  <input type="submit" /> 


input { 
   color:black; } 
/* placeholder only style */ 
input.studentid:-ms-input-placeholder { 
   color: red; 
   background-color: yellow; 



Not part of any specification but Microsoft has a description on a description on MSDN.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support No support No support 10 No support No support
Feature Android Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support No support No support No support (Yes) No support No support

See also

Document Tags and Contributors

 Contributors to this page: rahuldecoded, teoli, mrenty, cvrebert
 Last updated by: rahuldecoded,