Change an HTML5 input's placeholder color with CSS

后端 未结 30 3169
猫巷女王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 05:06

    Use the new ::placeholder if you use autoprefixer.

    Note that the .placeholder mixin from Bootstrap is deprecated in favor of this.

    Example:

    input::placeholder { color: black; }
    

    When using autoprefixer the above will be converted to the correct code for all browsers.

提交回复
热议问题