1
votes

Try to set placeholder background color. It works fine until i try to increase input field height. In mozilla & ie placeholder background fills all space inside input. But in webkit background is set only for placeholder text height.

Here is an example: http://jsfiddle.net/3zp36wL7/2/

::-webkit-input-placeholder { 
    color: red;
    background: yellow;
}

You'll see yellow background in FF & IE, but in Chrome or Safari it looks terrible.

Is there any solution via css?

1
you could give the input a line-height equal to the height.Jmh2013

1 Answers

1
votes

You can use line-height instead height;

Fiddle

CSS

 ::-webkit-input-placeholder { 
    color: red;
    background: yellow;
 }
 :-moz-placeholder { 
   color: red;
   background: yellow;
 }
 ::-moz-placeholder { 
    color: red;
    background: yellow;
 }
 :-ms-input-placeholder { 
    color: red;
    background: yellow;
 }

 input {
    line-height: 50px;
 }