pseudo-element

::placeholder — CSS reference

Styles placeholder text when present in an input or textarea. This is distinct from :placeholder-shown, which matches the control itself. A placeholder is not a substitute for a persistent accessible label.

Formal Syntax & Structure

css syntaxcss
input::placeholder { color: teal; }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>#a {color:#202020} #a::placeholder {color:#006050;opacity:1}</style><body><label for="a">City</label><input id="a" placeholder="Example: Tehran"></body></html>
CSS Reference