Change an HTML5 input's placeholder color with CSS

后端 未结 30 3177
猫巷女王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:42

    For Bootstrap and Less users, there is a mixin .placeholder:

    // Placeholder text
    // -------------------------
    .placeholder(@color: @placeholderText) {
      &:-moz-placeholder {
        color: @color;
      }
      &:-ms-input-placeholder {
        color: @color;
      }
      &::-webkit-input-placeholder {
        color: @color;
      }
    }
    

提交回复
热议问题