Textarea占位符不适用于Chrome for Mac中的模糊

时间:2014-08-11 12:04:27

标签: html css google-chrome

Chrome for Mac中的textarea元素有问题。 具体来说,当用户在其外部点击时,它不会还原到原始占位符。

这就是它现在的工作方式:

This is how it's working

这就是它应该如何运作:

And this is how it should work

1 个答案:

答案 0 :(得分:0)

<强> Demo

enter image description here

CSS

textarea:focus::-webkit-input-placeholder 
{
    color: transparent;
}
textarea:focus::-moz-placeholder{
    color: transparent;
}
textarea:focus:-moz-placeholder{
    color: transparent;
}
input:focus::-webkit-input-placeholder 
{
    color: transparent;
}
input:focus::-moz-placeholder{
    color: transparent;
}
input:focus:-moz-placeholder{
    color: transparent;
}

HTML

<input placeholder="I am an input" />
<input placeholder="I am an input" />
<input placeholder="I am an input" />

<textarea placeholder="I am a textarea" cols="30" rows="5"></textarea>