Skip to content
How to set input text color, but not placeholder color, in IE11 .
add a comment | 3. The placeholder text is set with the placeholder attribute, which specifies a hint that describes the expected value of an input field. Compose the code according to the information below (note, you need to put the same code 4 times for each Choose a file to place your code in.
Change an HTML5 input's placeholder color with CSS. ; Note that placeholder text is just cut off if it doesn’t fit – size your input elements in em and test them with big minimum font size settings. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. Featured on Meta
Instead of checking values against the placeholder text you should really use a data-modified flag on the input, and then clear the input on form submit if the flag is not set.
Stack Overflow for Teams is a private, secure spot for you and
::placeholder {
Firefox's placeholder appears to be defaulting with a reduced opacity, so needs to use opacity: 1 here.
hint that describes the expected value of an input field.The numbers in the table specify the first browser version that fully supports the selector.Numbers followed by -webkit-, -moz- or -ms- specify the first version that worked with a prefix.If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Der Textplatzhalter im Formularfeldern enthält einen Hinweis, der die erwarteten Daten im Feld zeigt. Examples might be simplified to improve reading and basic understanding. If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. Reply . Don’t forget translations: some languages need more room for the same word. You can put it in any CSS file of your site, but we’ve prepared a list of recommended files for each template engine: So, we need to When using autoprefixer the above will be converted to the correct code for all browsers.Now we have a standard way to apply CSS to an input's placeholder : I just realize something for Mozilla Firefox 19+ that the browser gives an opacity value for the placeholder, so the color will not be what you really want.I don't remember where I've found this code snippet on the Internet (it wasn't written by me, don't remember where I've found it, nor who wrote it).Just load this JavaScript code and then edit your placeholder with CSS by calling this rule:I think this code will work because a placeholder is needed only for input type text. Learn how to change the color of the placeholder attribute with CSS.Use an input element and add the placeholder attribute:In most browsers, the placeholder text is grey.
Change an HTML5 input placeholder color with CSS Last Updated: 04-12-2018 In most of the browsers, the placeholder (in input tag) is of grey color, to change the color of this placeholder, non-standard ::placeholder selectors can be used, by which implement the color attribute in … Normally, HTML input field placeholder text is rendered using default styles and a slightly gray color. For anyone else hard-refreshing and wondering why the heck this doesn't appear to be working ("why is my white text still grey.."), use opacity:1Note for Bootstrap 3: "form-control" class overrides the color due to CSS specificity (i.e. your coworkers to find and share information. 1197. a sample value or a short description of the expected format).
W3Schools is optimized for learning, testing, and training. W3Schools is optimized for learning, testing, and training. While using this site, you agree to have read and accepted our
The placeholder text is set with the placeholder attribute, which specifies a hint that describes the expected value of an input field.
Save the changes and upload the CSS file to your server.Feel free to check the detailed video tutorial below:This tutorial will show you how to create a vertical and horizontal menus in HTML using CSS styles.
See So we need separate rules for each browser. This tutorial shows how to change the placeholder text color of an input of any form.. How to change the placeholder text color of an input. Placeholder text typically has a lighter color treatment to indicate that it is a suggestion for what kind of input will be valid, and is not actual input of any kind. If you come back again to the form you lost everything!
Changing the Input Placeholder Color with ::placeholder Selector.