Non-standard
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" /> </form>
input { background-color:#E8E8E8; color:black; } /* placeholder only style */ input.studentid:-ms-input-placeholder { font-style:italic; color: red; background-color: yellow; }
Not part of any specification but Microsoft has a description on a description on MSDN.
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | No 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 |
© 2005–2018 Mozilla Developer Network and individual 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