Is there a way to change the color of an HTML5 textbox watermark?

This question already has an answer here:

  • Change an HTML5 input's placeholder color with CSS 31 answers

  • See this answer.

    Long story short, you need to use CSS Selectors to apply the rules to each browser, which handles the process differently.

    input.mytextbox::-webkit-input-placeholder {
      /* WebKit browsers */
      color: red;
    }
    
    input.mytextbox:-moz-placeholder {
      /* Mozilla Firefox 4 to 18 */
      color: red;
      opacity: 1;
    }
    
    input.mytextbox::-moz-placeholder {
      /* Mozilla Firefox 19+ */
      color: red;
      opacity: 1;
    }
    
    input.mytextbox:-ms-input-placeholder {
      /* Internet Explorer 10+ */
      color: red;
    }
    <input class="mytextbox" type="text" name="mytextbox" placeholder="MyTextBox"/>
    链接地址: http://www.djcxy.com/p/12168.html

    上一篇: 在Chrome 42中为输入占位符(默认和焦点状态)设置样式

    下一篇: 有没有办法改变HTML5文本框水印的颜色?