Textarea占位符不占用属性

时间:2016-10-20 06:33:43

标签: html css placeholder

我的问题是textarea占位符没有采用css属性

我有HTML:

<textarea id="information" class="career-form-textbox" name="message" placeholder="Add a cover letter or anything else you want to
share.">
</textarea>

我有CSS:

input,
textarea::-webkit-input-placeholder {
  color: #848484;
  font-size: 18px;
  font-weight: 400;
  opacity: 0.2;
  font-family: Open Sans;
}

input,
textarea:-moz-placeholder,
color #848484 {
  font-size: 18px;
  font-weight: 400;
  opacity: 0.2;
  font-family: Open Sans;
}

input,
textarea::-moz-placeholder,
color #848484 {
  font-size: 18px;
  font-weight: 400;
  opacity: 0.2;
  font-family: Open Sans;
}

input,
textarea:-ms-input-placeholder,
color #848484 {
  font-size: 18px;
  font-weight: 400;
  opacity: 0.2;
  font-family: Open Sans;
}

但它不起作用,提前谢谢,抱歉格式错误 浏览器:Chrome

1 个答案:

答案 0 :(得分:1)

您发布的css代码中似乎存在一些语义错误。试试这个:

&#13;
&#13;
input,
textarea::-webkit-input-placeholder { /* WebKit browsers */
    color: #848484;
}
input,
textarea:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
   color: #848484;
   opacity:  1;
}
input,
textarea::-moz-placeholder { /* Mozilla Firefox 19+ */
   color: #848484;
   opacity:  1;
}
input,
textarea:-ms-input-placeholder { /* Internet Explorer 10+ */
   color: #848484;
}
&#13;
<textarea id="information" class="career-form-textbox" name="message"
placeholder="Add a cover letter or anything else you want to
share."></textarea>
&#13;
&#13;
&#13;