Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On Edge Browser, how to change input placeholder text color using CSS?

On Edge Browser, I couldn't able to change input placeholder color.

:-ms-input-placeholder is not working but works fine on IE 10 & IE 11.

input:-ms-input-placeholder {
    font-style:italic;        
    color: red;
    background-color: yellow;
}

is there anyway to make it work using CSS?

like image 356
Muthu Kumaran Avatar asked Aug 19 '15 12:08

Muthu Kumaran


People also ask

How do I change the color of placeholder input box?

In most browsers, the placeholder text is grey. To change this, style the placeholder with the non-standard ::placeholder selector. Note that Firefox adds a lower opacity to the placeholder, so we use opacity: 1 to fix this.

How do I change placeholder text in CSS?

Change Input Placeholder Text with CSS You can use the ::placeholder pseudo-element to change the styles of the placeholder text, which includes the ability to change the background. The code in this example uses a Sass function to generate code for support in older browsers as well.

What is input placeholder color?

The placeholder text is set with the placeholder attribute, which specifies a hint that describes the expected value of an input field. Tip: The default color of the placeholder text is light grey in most browsers.


3 Answers

From CanIUse.com

::-webkit-input-placeholder for (Chrome/Safari/Opera)

:-ms-input-placeholder for IE.

::-ms-input-placeholder for Edge (also supports webkit prefix)

Note the double colon syntax

like image 67
Paulie_D Avatar answered Oct 16 '22 16:10

Paulie_D


I want to second @ken's comment on @Paulie_D's answer, above.

This works: input[type="text"]::-ms-input-placeholder { color: #000; }

This doesn't: input[type="text"]::placeholder, input[type="text"]::-ms-input-placeholder { color: #000; }

I'm not sure why, but it definitely appears that the -ms-input-placeholder pseudo-element only works if it's separate from other directives.

like image 15
David Walton Avatar answered Oct 16 '22 17:10

David Walton


For the current version of the Microsoft Edge browser, placeholder doesn't work correctly. Take a look this issue Microsoft Edge placeholder bug. If placeholder is invisible, try to remove position: relative and :-webkit-input-placeholder opacity.

like image 8
Stanislav Ostapenko Avatar answered Oct 16 '22 15:10

Stanislav Ostapenko