Like any psuedo, you can scope it to specific elements as needed, like: input[type="email"].big-dog::-webkit-input-placeholder { color: orange; } Example The ::placeholder selector selects form elements with placeholder text, and let you style the placeholder text. But thanks to the ::placeholder pseudo element you can change this to fit your needs. Tip: The default color of the placeholder text … If you are not familiar with pseudo element selectors they are typically prefixed by ::. ::placeholder { color: red; font-size: 1.5em; } 在使用了 ::placeholder 伪元素的选择器中,仅有小一部分CSS属性可以使用,这个集合可以参考 ::first-line 伪元素。 语法 Examples might be simplified to improve reading and basic understanding. ::placeholder { color: blue; font-size: 1.5em; } Only the subset of CSS properties that apply to the ::first-line pseudo-element can be used in a rule using ::placeholder in its selector. 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. Demo. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. The placeholder text is set with the placeholder attribute, which specifies a hint that describes the expected value of an input field. The short hint is displayed in the input field before the user enters a value. Sometimes you might see a single :, but the may only apply to some vendor specific implementations.

I am trying to apply css (i.e. T… Normally, HTML input field placeholder text is rendered using default styles and a slightly gray color.

Note: In most browsers, the appearance of placeholder text is a translucent or light gray color by default. /* Chrome, Firefox, Opera, Safari 10.1+ */

Just for the record… if anyone requires different coloured placeholders on different elements you can narrow down your selection like this: #first-element ::-webkit-input-placeholder {color: black;} #second-element::-webkit-input-placeholder {color: red;} Change the color of the placeholder text of an input field:The placeholder text is set with the placeholder attribute, which specifies a W3Schools is optimized for learning, testing, and training.

Examples might be simplified to improve reading and basic understanding. After some hit and try, I get solution of my problem, but it's amazing. 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: Note that Firefox adds a lower opacity to the placeholder, so we use opacity: 1 to fix this. In most browsers, the placeholder text is grey.

While using this site, you agree to have read and accepted our While using this site, you agree to have read and accepted our Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. 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-shown is standard, and even spec authors seem to think ::placeholder will be the standardized version. a sample value or a short description of the expected format). I am getting some problem in applying placeholder css. The placeholder attribute specifies a short hint that describes the expected value of an input field (e.g. To change this, style the placeholder with the non-standard ::placeholder selector. W3Schools is optimized for learning, testing, and training. ::placeholder { To change this, style the placeholder with the non-standard If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail: color:#898F9C;) on input-box placeholder using pseudo-class selector :-ms-input-placeholder, but it's not working in IE.

The key to applying special colors and other styling to an HTML input's placeholder text is defining unique rules for the ::placeholder pseudo elements.