我正在嘗試將 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;
}
uj5u.com熱心網友回復:
要更改占位符文本的顏色,您可以在 :placeholder 樣式中使用 CSS 屬性顏色。
要更改 textarea 邊框的顏色,您可以在 textarea 樣式中使用 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>
uj5u.com熱心網友回復:
CSS 代碼:此更改,textarea 中的字體顏色
.textarea {
resize: both;
width: 100%;
border: 1;
color:lightgrey;
}
這會改變 textarea 的邊框顏色
.textarea {
resize: both;
width: 100%;
border: 1;
border-color:lightgrey;
}
uj5u.com熱心網友回復:
你可以這樣做:
border: solid 1px lightgrey
textarea {
resize: both;
width: 100%;
border: solid 1px lightgrey;
}
<label for="" class="field_label">What</label>
<textarea placeholder="" id=""></textarea>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/322078.html
下一篇:在嵌套網格中包含影像
