我正在尝试将textarea占位符更改为浅灰色,但似乎不能。
https://jsfiddle.net/mardystellar/pcvqgzuj/3/
有什么方法可以覆盖用户代理样式表吗?这是我第一次使用css。我只找到了更改焦点边框的答案,而不是默认的形式。
<label for="" class="field_label">What</label>
<textarea placeholder="" id=""></textarea>CSS
textarea {
resize: both;
width: 100%;
}
textarea::placeholder {
border-color: lightgrey;
}发布于 2021-10-18 08:07:10
你可以这样做:
border: solid 1px lightgrey
textarea {
resize: both;
width: 100%;
border: solid 1px lightgrey;
}<label for="" class="field_label">What</label>
<textarea placeholder="" id=""></textarea>
发布于 2021-10-18 08:11:50
若要更改占位符文本的颜色,可以在:占位符样式中使用CSS属性color。
要更改文本区边框的颜色,可以在文本区样式中使用CSS属性border-color。
textarea {
resize: both;
width: 100%;
border-color: blue;
}
textarea::placeholder {
border-color: lightgrey;
color: red;
}<label for="" class="field_label">What</label>
<textarea placeholder="this is the placeholder" id=""></textarea>
发布于 2021-10-18 08:12:59
CSS代码:这会改变文本区域中的字体颜色
.textarea {
resize: both;
width: 100%;
border: 1;
color:lightgrey;
}这会改变textarea的边框颜色
.textarea {
resize: both;
width: 100%;
border: 1;
border-color:lightgrey;
}https://stackoverflow.com/questions/69612628
复制相似问题