input的placeholder颜色,textarea的placeholder颜色设置
input的placeholder颜色,textarea的placeholder颜色在有些浏览器上不受我们使用css来弄,这是因为浏览器自动给placeholder加了颜色的缘故。下面代码是按照自己的要求去修改placeholder颜色的代码,如果是移动端的话只用webkit就可以了,要是兼容IE8浏览器,放弃使用placeholder或者使用placeholder兼容相关的js,但是说实在的这个没啥用处,现在都什么年代了,还兼容IE浏览器。
<style type="text/css">
input::-webkit-input-placeholder, /*webkit*/
input:-moz-placeholder,/*Firefox19以下*/
input::-moz-placeholder,/*Firefox19及以上*/
input:-ms-input-placeholder
{
color: #333;
}
textarea::-webkit-input-placeholder, /*webkit*/
textarea:-moz-placeholder,/*Firefox18-*/
textarea::-moz-placeholder,/*Firefox19+*/
textarea:-ms-input-placeholder/*IE浏览器9+*/
{
color: #333;
}
</style>
好了,这个代码一般都是在移动端去使用的,如果你做的网站是移动端的网站,正好有修改placeholder颜色的需求,那么只要复制粘贴下面的代码就大功告成了。
<style type="text/css">
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder
{
color: #333;
}
</style>
0 条留言
去留言还没有留言。