Home > Web Front-end > HTML Tutorial > 【css3】How to customize placeholder text color_html/css_WEB-ITnose

【css3】How to customize placeholder text color_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:46:38
Original
1187 people have browsed it

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;}
Copy after login

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:

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template