CSS - :-ms-input-placeholder
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.
Example
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.
HTML
<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" /> </form>
CSS
input { background-color:#E8E8E8; color:black; } /* placeholder only style */ input.studentid:-ms-input-placeholder { font-style:italic; color: red; background-color: yellow; }
Result
Description
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.
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
Specifications
Not part of any specification but Microsoft has a description on a description on MSDN.
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/css/:-ms-input-placeholder