[Css3] How to customize the placeholder text color,

Source: Internet
Author: User

[Css3] How to customize the placeholder text color,

Yesterday I wrote an article about implementing ie browser compatibility with placeholder Based on jquery. Click the portal for details. However, it is still a little flawed, that is, the placeholder text color cannot be set. This article describes how to use css to modify the placeholder text color.

For ie browsers, we can directly modify the style of the span label using the custom class name. For other browsers, such as Google and Firefox, special processing is required. If you don't need to talk about it, 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 that the first line of code is used in Google's browser, and the last two lines of code are used in Firefox, where:-moz-placeholder is used in Mozilla Firefox 19 +, while: -moz-placeholder is used in Mozilla Firefox 4-18. As follows:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.