textarea专注于chrome?

时间:2016-01-15 10:52:55

标签: html css google-chrome

我正在尝试使用单击焦点实现textarea,删除占位符文本。它适用于Firefox和IE,但不适用于Chrome。不知道我在这里做些什么傻事......

HTML:

<textarea id="bio" name="user_bio" placeholder="Hi, I am a member of Footdrive!"></textarea>

CSS:

/*Input fields focus and text transparency*/

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

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

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

 input:focus:-ms-input-placeholder {
    color: transparent;
}


/*Biography field focus and text transparency*/

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

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

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

textarea:focus:-ms-textarea-placeholder {
    color: transparent;
}

2 个答案:

答案 0 :(得分:1)

正确的解决方案与输入相同:

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

答案 1 :(得分:0)

您可以尝试:

textarea:focus::-webkit-textarea-placeholder {
    content: "";
}