


Introduction to how to modify placeholder style with CSS (code example)
The content of this article is an introduction to the method of modifying the placeholder style with CSS. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Project users often encounter the need to modify the color of the input placeholder. Here is a look at how to set the placeholder with css:
First, let’s take a look at the default input style of chrome
<input>
(placeholder)
(input style)
placeholder and The default color of
input is a little different. Now let's modify the color of
input
<input>(placeholder)
color attribute can only change the color of the input value, but the color of
placeholder does not change at all. So, how to change the color of
placeholder.
placeholder, you need to use the pseudo class
::placeholder
<input>(placeholder)
::placeholder pseudo-class, the above is in the chrome browser The running result, the same code becomes like this in IE11
:-ms-input-placeholder, and the attribute needs to be added with
!important to increase the priority.
<input>(placeholder ie11)
/* - Chrome ≤56, - Safari 5-10.0 - iOS Safari 4.2-10.2 - Opera 15-43 - Opera Mobile >12 - Android Browser 2.1-4.4.4 - Samsung Internet - UC Browser for Android - QQ Browser */ ::-webkit-input-placeholder { color: #ccc; font-weight: 400; } /* Firefox 4-18 */ :-moz-placeholder { color: #ccc; font-weight: 400; } /* Firefox 19-50 */ ::-moz-placeholder { color: #ccc; font-weight: 400; } /* - Internet Explorer 10–11 - Internet Explorer Mobile 10-11 */ :-ms-input-placeholder { color: #ccc !important; font-weight: 400 !important; } /* Edge (also supports ::-webkit-input-placeholder) */ ::-ms-input-placeholder { color: #ccc; font-weight: 400; } /* CSS Working Draft */ ::placeholder { color: #ccc; font-weight: 400; }Summary: The above is the entire content of this article, I hope it will be helpful to everyone's learning.
The above is the detailed content of Introduction to how to modify placeholder style with CSS (code example). For more information, please follow other related articles on the PHP Chinese website!

Article discusses CSS margin property, specifically "margin: 40px 100px 120px 80px", its application, and effects on webpage layout.

The article discusses CSS border properties, focusing on customization, best practices, and responsiveness. Main argument: border-radius is most effective for responsive designs.

The article discusses CSS background properties, their uses in enhancing website design, and common mistakes to avoid. Key focus is on responsive design using background-size.

Article discusses CSS HSL colors, their use in web design, and advantages over RGB. Main focus is on enhancing design and accessibility through intuitive color manipulation.

The article discusses the use of comments in CSS, detailing single-line and multi-line comment syntaxes. It argues that comments enhance code readability, maintainability, and collaboration, but may impact website performance if not managed properly.

The article discusses CSS Selectors, their types, and usage for styling HTML elements. It compares ID and class selectors and addresses performance issues with complex selectors.

The article discusses CSS priority, focusing on inline styles having the highest specificity. It explains specificity levels, overriding methods, and debugging tools for managing CSS conflicts.

Article discusses CSS syntax, learning strategies, common mistakes, and validation tools. Main focus is on mastering CSS through practice and understanding.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Notepad++7.3.1
Easy-to-use and free code editor

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor
