
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
How to Change Placeholder Color for Textboxes in CSS
Using the ::placeholder pseudo-element, we can change the placeholder text color for textboxes.
The syntax of CSS ::placeholder pseudo-element is as follows −
::placeholder { attribute: /*value*/ }
Example
The following examples illustrate CSS :: placeholder pseudo-element.
<!DOCTYPE html> <html> <head> <style> input:last-child::placeholder { color: cornflowerblue; } </style> </head> <body> <input type="text" placeholder="Default color" /> <input type="text" placeholder="Check my new color :D" /> </body> </html>
Output
This will produce the following result −
Example
<!DOCTYPE html> <html> <head> <style> input::placeholder { color: fuchsia; } input { margin: 2%; width: 100%; } div { display: flex; flex-direction: column; margin: 3%; padding: 3%; text-align: center; align-items: center; box-shadow: inset 0 0 30px brown; } button { width: 40%; } </style> </head> <body> <div> <input type="text" placeholder="Normal placeholder" /> <input type="email" placeholder="somenone@somewhere.com" /> <button>dummy btn</button> </div> </body> </html>
Output
This will produce the following result −
- Related Articles
- How to change the color of the placeholder attribute with CSS?
- How to change an HTML5 input's placeholder color with CSS?
- How to change link color in CSS?
- How to Change Link Underline Color using text-decoration-color CSS
- Change Bullet Color for Lists with ::marker CSS Selector
- Change Cursor Color with CSS caret-color
- How to change the color of active links with CSS
- How to change the color of focused links with CSS
- How to change the color of selected text using CSS?
- How to change background-color on a specific wider viewport in CSS ?
- How to change the color of the radio button using CSS?
- Using CSS :placeholder-shown to Customize Styles for Empty Text Input
- How to change the color of points for ggplot2 scatterplot using color brewer in R?
- Change the color of right border with CSS
- Change the Color of Active Links with CSS

Advertisements