input placeholder 颜色修改

方法一:


::-webkit-input-placeholder { /* WebKit browsers */ color: #fff; } :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #fff; opacity: 1; } ::-moz-placeholder { /* Mozilla Firefox 19+ */ color: #fff; opacity: 1; } :-ms-input-placeholder { /* Internet Explorer 10+ */ color: #fff; }
  /* opacity: 1;是为了修改FF的默认透明度导致颜色偏差; */



方法二:
<input type="text" value="placeholder text" onfocus="if(!this.haswriting){this.style.color='#000'; this.value='';}" onblur="if(!this.value){this.style.color='#f00'; this.value='placeholder text'; this.haswriting=false;}else{this.haswriting=true};" style="color: #f00;"/>

  

  

posted @ 2017-11-30 16:17  loewe0202  阅读(202)  评论(0编辑  收藏  举报