Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font color of placeholder difference between Firefox 23.0.1 Chrome 23.0.1271.64 and IE 8

I changed the placeholder font color of an input field to blue, I've tested it in Chrome, it's color is blue. But in FF 23.0.1, the color is slightly "lighter" than blue.

See the contrast below, note the "Month" is within a span and color is also blue:

In Chrome, it's fine, see below:

enter image description here

However, in firefox 23.0.1, looked like this:

enter image description here

In IE8, not display:

enter image description here

Note the difference of the color.

Below is the css code I am using:

.month_span { color: blue; }
.input::-webkit-input-placeholder { color:blue}
.input::-moz-placeholder { color:blue; } /* FF 19+ */
.input:-moz-placeholder { color:#bbb; } /* FF 18- */
.input:-ms-input-placeholder { color:#bbb; }

My Question:1. Why the color is lighter in FF? 2. How to display placeholder value in IE?

like image 642
JavaScripter Avatar asked Aug 24 '13 06:08

JavaScripter


People also ask

What is the color of placeholder text?

In most browsers, the placeholder text is grey.

What is placeholder color CSS?

CSS ::placeholder Selector 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.

How do you style a placeholder text?

Use the ::placeholder pseudo-element to style your placeholder text in an <input> or <textarea> form element. Most modern browsers support this, but for older browsers, vendor prefixes will be required.

What will happen if you change the font size in the placeholder?

Placeholder styles will not resize an input field and will not affect its box model. Add font-size to your input to fix the placeholder from getting cut off. You also might consider adding placeholder styles for other browsers... Save this answer.


1 Answers

The placeholder attribute isn't supported by IE until IE 10, so that explains that.

Firefox apparently applies opacity:0.54 to the placeholder text: http://css-tricks.com/snippets/css/style-placeholder-text/

This will fix:

.input::-moz-placeholder { color:blue; opacity: 1; } /* FF 19+ */
.input:-moz-placeholder { color:#bbb; opacity: 1; } /* FF 18- */
like image 119
David Goss Avatar answered Nov 15 '22 21:11

David Goss