The running result value is still gray, Color: red has no effect. Is there any way to change the color of placeholder text? I installed the jQuery placeholder text plugin in my browser, but it still doesn't work. (!important is only recognized by IE7 and firefox)
Answer:
toscho: There are three implementation methods: pseudo-elements, pseudo-classes and Notihing. WebKit and Blink (Safari, Google Chrome, Opera15) use pseudo elements
Copy code
The code is as follows:
::-webkit-input-placeholder
Mozilla Firefox 4-18 uses the pseudo class
Copy the code
The code is as follows:
:-moz-placeholder
Mozilla Firefox 19 uses pseudo-element
Copy code
The code is as follows:
::-moz-placeholder
IE10 uses the pseudo class
Copy the code
The code is as follows:
:-ms-input -placeholder
CSS selectors in versions below IE9 and Opera12 do not support placeholder text. It should be noted that pseudo elements will play the real role of elements in Shadow DOM.
CSS Selector
Because the CSS selector of each browser is different, separate settings need to be made for each browser.
Copy code
The code is as follows:
::-webkit-input-placeholder { /* WebKit browsers */ color: #999; } :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #999; } ::-moz-placeholder { /* Mozilla Firefox 19 */ color: #999; } :-ms-input-placeholder { /* Internet Explorer 10 */ color: #999; }
Matt: The code for textareas (text box stretchable) style is as follows:
brillout.com: input and The font color of Textarea is all red. All styles must be specific to different selectors and should not be packaged as a whole, because if one of them fails, the others will fail.
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