如何用css3改变占位符颜色?

前端之家收集整理的这篇文章主要介绍了如何用css3改变占位符颜色?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
参见英文答案 > Change an HTML5 input’s placeholder color with CSS27个答案Google Chrome和Mozilla Firefox在输入端支持占位符属性。我如何改变占位符的颜色
我的代码
<input type="text" placeholder="change color" />

解决方法

对于Mozilla< 19
<style type="text/css">  
    input:-moz-placeholder {  
      color: green;  
    }  
</style>

对于Mozilla 19起

<style type="text/css">  
    input::-moz-placeholder {  
      color: green;  
    }  
</style>

适用于Google Chrome

<style type="text/css">  
    input::-webkit-input-placeholder {  
      color: green;  
    }  
</style>

对于IE 10

<style type="text/css">  
    input:-ms-input-placeholder {  
      color: green;  
    }  
</style>
原文链接:https://www.f2er.com/css/218164.html

猜你在找的CSS相关文章