Change an HTML5 input's placeholder color with CSS

后端 未结 30 3101
猫巷女王i
猫巷女王i 2020-11-21 04:36

Chrome supports the placeholder attribute on input[type=text] elements (others probably do too).

But the following CSS doesn\'t do anything

30条回答
  •  半阙折子戏
    2020-11-21 04:48

    You can change an HTML5 input's placeholder color with CSS. If by chance, your CSS conflict, this code note working , you can use (!important) like below.

    ::-webkit-input-placeholder { /* WebKit, Blink, Edge */
        color:#909 !important;
    }
    :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
       color:#909 !important;
       opacity:1 !important;
    }
    ::-moz-placeholder { /* Mozilla Firefox 19+ */
       color:#909 !important;
       opacity:1 !important;
    }
    :-ms-input-placeholder { /* Internet Explorer 10-11 */
       color:#909 !important;
    }
    ::-ms-input-placeholder { /* Microsoft Edge */
       color:#909 !important;
    }
    
    
    

    Hope this will help.

提交回复
热议问题