Yesterday I wrote an article based on jquery to implement IE browser compatible placeholder effect. Click the portal for the specific content. However, there is still a small flaw, that is, the placeholder text color cannot be set. This article mainly introduces the use of css to modify the placeholder text color.
For IE browser, we can directly modify the style of the span tag through the customized class name. For other browsers such as Google and Firefox, special processing is required. Let’s go directly to the code:
css:
::-webkit-input-placeholder{color:#f00;}::-moz-placeholder{color:#f00;}:-moz-placeholder{color:#f00;}
According to the prefix, we know the first The first line of code works on Google Chrome, and the last two lines of code work on Firefox, where ::-moz-placeholder is used for Mozilla Firefox 19 versions, and :-moz-placeholder is used for Mozilla Firefox 4-18 versions. The rendering is as follows: