input的placeholder颜色,textarea的placeholder颜色设置

浏览: 2,563次 日期:2017年12月08日 22:49:05 作者:青格勒

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>

文章链接:http://cenggel.com/htmlcss/14.html

版权声明:文章《input的placeholder颜色,textarea的placeholder颜色设置》由青格勒编写,转载请带上文章链接。

本章内容纯属乱讲,如有雷同,纯属巧合。如有借鉴之处已表明出处。

点击任意位置关闭窗口,感谢您的支持。


打赏规则 - 为了避免对于打赏模式产生误解,说明一下几点内容:

  • 1.打赏纯粹自愿,金额不限,别太多,1块就行;
  • 2.打赏不能作为解答疑问的理由;
  • 3.打赏不能帮你做毕业设计或论文;
  • 4.打赏不能帮你做工作中的项目;
  • 5.打赏就是这不能那不能,只是单纯打赏而已。
  • 5.最后谢谢支持。
关闭
相关文章

发表评论

邮箱地址不会被公开。 必填项已用*标注