Web Browser Support For The HTML placeholder Attribute And The CSS *placeholder Selectors On Textboxes And Textareas: Tests And Results
1. Introduction
Concerning HTML, textboxes use the input element with the type="text" attribute and textareas use the textarea element. The textbox input element, the textbox input element with the type="text" attribute, and the textarea textarea element are referred to as the textbox/textarea elements. Concerning CSS, the selectors for textboxes are the input type selector and, with more specificity, the input[type="text"] attribute selector, and the selector for textareas is the textarea type selector. The textbox input selector, the textbox input[type="text"] selector, and the textarea textarea selector are referred to as the textbox/textarea selectors.
1.1. The HTML placeholder Attribute
The HTML placeholder attribute is a commonly used optional attribute for textboxes and textareas. The textbox/textarea placeholder attribute value is displayed in the textbox/textarea as temporary placeholder text until, depending upon the web browser, the textbox/textarea receive focus or text is entered into the textbox/textarea.
1.1.1. Web Browser Support For The HTML placeholder Attribute On Textboxes And Textareas
| Textbox / Textarea Element | IE Support | ED Support | FF Support | SF Support | CH Support | OP Support |
|---|---|---|---|---|---|---|
|
IE10+ | ED12+ | FF4+ | SF3.1+ | CH2+ | OP11+ |
Textarea textarea element |
IE10+ | ED12+ | FF4+ | SF5+ | CH4+ | OP11.50+ |
1.2. The CSS Selectors For Styling The Placeholder Text
The following CSS selectors can be used to style the placeholder text:
- The previously described textbox/textarea selectors (
input,input[type="text"], andtextarea). - The textbox
input[placeholder]attribute selector and the textareatextarea[placeholder]attribute selector. The textboxinput[placeholder]selector and the textareatextarea[placeholder]selector are referred to as the textbox/textarea placeholder attribute selectors. The textbox/textarea placeholder attribute selectors are typically not used to style the placeholder text. - The web browser vendor prefix pseudo-class selectors (
:-ms-input-placeholderand:-moz-placeholder), the web browser vendor prefix pseudo-element selectors (::-ms-input-placeholder,::-moz-placeholder, and::-webkit-input-placeholder), and the W3C proposed web browser vendor independent pseudo-element selector (::placeholder). These selectors are referred to as the CSS*placeholderselectors.
The styles of the CSS *placeholder selectors override the styles of the textbox/textarea selectors and the textbox/textarea placeholder attribute selectors.
1.3. The CSS *placeholder Selectors
The CSS *placeholder selectors can be used to style the placeholder text in the following ways:
- With more specificity, appended to the textbox/textarea selectors. For example, the
::-ms-input-placeholderselector appended to the textboxinputselector:input::-moz-placeholder { opacity: 0.54; } - With less specificity, as standalone selectors. For example, the
::-webkit-input-placeholderselector as a standalone selector:::-webkit-input-placeholder { color: rgb(169,169,169); }The*placeholderselectors as standalone selectors are equivalent to the*placeholderselectors appended to the universal*selector. For example, the::-webkit-input-placeholderselector is equivalent to the*::-webkit-input-placeholderselector.
1.3.1. Web Browser Support For The CSS *placeholder Selectors On Textboxes And Textareas
| How Used (Appended To / As Standalone) | CSS *placeholder Selector |
IE Support | ED Support | FF Support | SF Support | CH Support | OP Support |
|---|---|---|---|---|---|---|---|
|
:-ms-input-placeholder |
IE10+ | - | - | - | - | - |
::-ms-input-placeholder |
- | ED12+ | - | - | - | - | |
:-moz-placeholder |
- | - | FF4 - 18 | - | - | - | |
::-moz-placeholder |
- | - | FF19+ | - | - | - | |
::-webkit-input-placeholder |
- | ED12+ | - | SF4+ | CH2+ | OP15+ | |
::placeholder |
- | - | - | - | - | - | |
|
:-ms-input-placeholder |
IE10+ | - | - | - | - | - |
::-ms-input-placeholder |
- | ED12+ | - | - | - | - | |
:-moz-placeholder |
- | - | FF4 - 18 | - | - | - | |
::-moz-placeholder |
- | - | FF19+ | - | - | - | |
::-webkit-input-placeholder |
- | ED12+ | - | SF5+ | CH4+ | OP15+ | |
::placeholder |
- | - | - | - | - | - |
1.4. Abbreviations
- IE = Internet Explorer.
- ED = Edge Legacy 12 - 18 (EdgeHTML based) and Edge 79+ (Chromium based).
- FF = Firefox.
- SF = Safari.
- CH = Chrome.
- OP = Opera.
2. Web Browser Support For The HTML placeholder Attribute On Textboxes And Textareas: Tests And Results
- Web Browser Support For The HTML
placeholderAttribute On The TextboxinputAnd TextareatextareaElements: Tests And Results (learnwebcoding.com). - Web Browser Support For The HTML
placeholderAttribute On The TextboxinputElement With Thetype="text"Attribute: Test And Results (learnwebcoding.com).
3. Web Browser Support For The CSS :-ms-input-placeholder Selector On Textboxes And Textareas: Tests And Results
- Web Browser Support For The CSS
:-ms-input-placeholderSelector Appended To The TextboxinputAnd TextareatextareaSelectors: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
:-ms-input-placeholderSelector Appended To The Textboxinput[type="text"]Selector: Test And Results (learnwebcoding.com). - Web Browser Support For The CSS
:-ms-input-placeholderSelector As A Standalone Selector On The TextboxinputAnd TextareatextareaElements: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
:-ms-input-placeholderSelector As A Standalone Selector On The TextboxinputElement With Thetype="text"Attribute: Test And Results (learnwebcoding.com).
4. Web Browser Support For The CSS ::-ms-input-placeholder Selector On Textboxes And Textareas: Tests And Results
- Web Browser Support For The CSS
::-ms-input-placeholderSelector Appended To The TextboxinputAnd TextareatextareaSelectors: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
::-ms-input-placeholderSelector Appended To The Textboxinput[type="text"]Selector: Test And Results (learnwebcoding.com). - Web Browser Support For The CSS
::-ms-input-placeholderSelector As A Standalone Selector On The TextboxinputAnd TextareatextareaElements: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
::-ms-input-placeholderSelector As A Standalone Selector On The TextboxinputElement With Thetype="text"Attribute: Test And Results (learnwebcoding.com).
5. Web Browser Support For The CSS :-moz-placeholder Selector On Textboxes And Textareas: Tests And Results
- Web Browser Support For The CSS
:-moz-placeholderSelector Appended To The TextboxinputAnd TextareatextareaSelectors: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
:-moz-placeholderSelector Appended To The Textboxinput[type="text"]Selector: Test And Results (learnwebcoding.com). - Web Browser Support For The CSS
:-moz-placeholderSelector As A Standalone Selector On The TextboxinputAnd TextareatextareaElements: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
:-moz-placeholderSelector As A Standalone Selector On The TextboxinputElement With Thetype="text"Attribute: Test And Results (learnwebcoding.com).
6. Web Browser Support For The CSS ::-moz-placeholder Selector On Textboxes And Textareas: Tests And Results
- Web Browser Support For The CSS
::-moz-placeholderSelector Appended To The TextboxinputAnd TextareatextareaSelectors: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
::-moz-placeholderSelector Appended To The Textboxinput[type="text"]Selector: Test And Results (learnwebcoding.com). - Web Browser Support For The CSS
::-moz-placeholderSelector As A Standalone Selector On The TextboxinputAnd TextareatextareaElements: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
::-moz-placeholderSelector As A Standalone Selector On The TextboxinputElement With Thetype="text"Attribute: Test And Results (learnwebcoding.com).
7. Web Browser Support For The CSS ::-webkit-input-placeholder Selector On Textboxes And Textareas: Tests And Results
- Web Browser Support For The CSS
::-webkit-input-placeholderSelector Appended To The TextboxinputAnd TextareatextareaSelectors: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
::-webkit-input-placeholderSelector Appended To The Textboxinput[type="text"]Selector: Test And Results (learnwebcoding.com). - Web Browser Support For The CSS
::-webkit-input-placeholderSelector As A Standalone Selector On The TextboxinputAnd TextareatextareaElements: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
::-webkit-input-placeholderSelector As A Standalone Selector On The TextboxinputElement With Thetype="text"Attribute: Test And Results (learnwebcoding.com).
8. Web Browser Support For The CSS ::placeholder Selector On Textboxes And Textareas: Tests And Results
- Web Browser Support For The CSS
::placeholderSelector Appended To The TextboxinputAnd TextareatextareaSelectors: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
::placeholderSelector Appended To The Textboxinput[type="text"]Selector: Test And Results (learnwebcoding.com). - Web Browser Support For The CSS
::placeholderSelector As A Standalone Selector On The TextboxinputAnd TextareatextareaElements: Tests And Results (learnwebcoding.com). - Web Browser Support For The CSS
::placeholderSelector As A Standalone Selector On The TextboxinputElement With Thetype="text"Attribute: Test And Results (learnwebcoding.com).