Change an HTML5 input placeholder color with CSS Last Updated : 08 Nov, 2021 Comments Improve Suggest changes Like Article Like Report The placeholder selector in the CSS pseudo-element is used to design the placeholder text by changing the text color and it allows to modify the style of the text. In most of the browsers, the placeholder (inside the input tag) is of grey color. In order to change the color of this placeholder, non-standard ::placeholder selectors can be used, which implements the color attribute in that particular selector. This selector varies from browser to browser. For eg, for Google Chrome, Mozilla Firefox, and Opera Browsers, etc, the selectors can be implemented as: Syntax: ::placeholder For Internet Explorer: :-ms-input-placeholder For Microsoft Edge: ::-ms-input-placeholder Example 1: This code shows the use of ::placeholder selectors in different browsers. HTML <!DOCTYPE html> <html> <head> <title>Change Placeholder Color</title> <style> ::placeholder { /* Firefox, Chrome, Opera */ color: blue; } :-ms-input-placeholder { /* Internet Explorer 10-11 */ color: red; } ::-ms-input-placeholder { /* Microsoft Edge */ color: orange; } </style> </head> <body> <p>Change Placeholder Color</p> <input type="text" placeholder="Enter your Text"> </body> </html> Output: In Google Chrome: In Microsoft Edge: In Internet Explorer: Note: The placeholder selector is no longer supported by Internet Explorer. Example 2: This code implements a placeholder selector in the email attribute of the input tag. Placeholder selectors can be applied to any attributes (text, tel, password, and etc) of the input tag, to highlight changes in color in any different attributes. HTML <!DOCTYPE html> <html> <head> <title>Change Placeholder Color</title> <style> input[type="email"]::placeholder { /* Firefox, Chrome, Opera */ color: blue; } input[type="email"]:-ms-input-placeholder { /* Internet Explorer 10-11 */ color: red; } input[type="email"]::-ms-input-placeholder { /* Microsoft Edge */ color: orange; } </style> </head> <body> <p>Change Placeholder Color</p> <input type="email" placeholder="Enter your Email"> </body> </html> Output: Comment More infoAdvertise with us B bilal-hungund Follow Improve Article Tags : Technical Scripter Web Technologies HTML Technical Scripter 2018 HTML5 HTML-Questions +2 More Similar Reads Remove border from IFrame using CSS The <iframe> tag is used to embed another web page within a webpage. To remove the border from an <iframe>, you can use the frameBorder attribute in the <iframe> tag, setting its value to "0".Syntax:<iframe frameBorder="value"></iframe>Note:The frameBorder attribute is 2 min read How to Hide Scrollbar with CSS Hiding the scrollbar with CSS can enhance the look of your webpage by removing visible scrollbars while still allowing users to scroll through content. This can create a cleaner, more streamlined user interface without sacrificing usability. In this article, weâll explore different methods for hidin 3 min read How to apply !important in CSS? The !important rule in CSS is used to add more importance to a property/value than normal. It forces a style to override any other declarations, ensuring the specified property value is applied, regardless of specificity. It helps resolve conflicts but should be used sparingly to avoid complicating 2 min read How to use a not:first-child Selector in CSS? The :not(:first-child) selector in CSS targets all elements that are not the first child within their parent. It allows you to style elements except the first one, making it useful for applying styles to subsequent items in a list or layout.Syntax:not( element ) { // CSS property } Example: In this 2 min read How to Auto-Resize an Image to Fit a Div Container? To resize an image or video to fit inside a div container, use the object-fit property for precise control over how the content fits.object-fit maintains the aspect ratio or stretches the content to fill the container.Common values include cover (fills the container, may crop) and contain (fits with 3 min read How to Disable Resizable Property of Textarea using CSS? The resize property is used to disable the resizeable property of Textarea using CSS, by setting the resize property to none.Note: The resize property in CSS controls whether an element, like a textarea, can be resized by the user.Disable Resizing of TextareaThe resize property in CSS controls an el 1 min read Create an Unordered List Without Bullets using CSS To create an unordered list without bullet points, the CSS list-style-type property is used. This removes the default bullet points from the list items, and making the list appear plain.Table of ContentUsing list-style-type property Remove margin and padding after removing bullet pointsUnordered Lis 1 min read Set cellpadding and cellspacing in CSS Cell Padding The cell padding is used to define the spaces between the cells and its border. If cell padding property is not applied then it will be set as the default value. Example: html <!DOCTYPE html> <html> <head> <title>cell padding</title> <style> table, th 1 min read How to overlay one div over another div using CSS Creating an overlay effect simply means putting two div together at the same place but both the div appear when needed i.e while hovering or while clicking on one of the div to make the second one appear. Overlays are very clean and give the webpage a tidy look. It looks sophisticated and is simple 2 min read How to disable a link using only CSS? To disable a link using CSS, pointer-events can be used, which sets whether the element in the page has to respond or not while clicking on elements. The pointer-events property is used to specify whether the element should respond to pointer events or not. The following example illustrates this app 3 min read Like