How to set the color and font style of placeholder text

后端 未结 5 1190
没有蜡笔的小新
没有蜡笔的小新 2021-02-13 19:17

I want to set the color to the placeholder, change the font style to bold, and increase the size.

How can I achieve this? Should I give style to the placeholder, or is t

5条回答
  •  醉酒成梦
    2021-02-13 19:49

    You can use the following code for cross-browser support:

    For Google Chrome:

    .element::-webkit-input-placeholder {
        color: blue;
        font-weight: bold;
    }
    

    For Mozilla Firefox:

    .element::-moz-placeholder {
        color: blue;
        font-weight: bold;
    }
    

    For Internet Explorer:

    .element:-ms-input-placeholder {
        color: blue;
        font-weight: bold;
    } 
    

    For Opera:

    .element:-o-input-placeholder {
        color: blue;
        font-weight: bold;
    } 
    

提交回复
热议问题