簡體   English   中英

如何更改文本區域中的字體顏色

[英]How to change the font color in a textarea

現在我有一個文本區域,可以從字符串中獲取文本。 我將文本區域的背景顏色設置為黑色,但是默認文本顏色是黑色,因此在突出顯示它之前您是看不到它的。 我似乎找不到將字體顏色更改為白色的方法。 CSS 中有一種簡單的方法可以做到這一點嗎?

html

<div class="mainWindow">
  <div class="valueOutput" [hidden]="hideThis">
    <textarea resize=none readonly="textareaEdit" rows="8" cols="50" style="background-color: black;" [(ngModel)]="outputTexT" ></textarea>
  </div>
  <div class="labelOutput" [hidden]="hideThis">
    <textarea readonly="textareaEdit" rows="8" cols="46" style="background-color: black;" [(ngModel)]="labelText"></textarea>
  </div>
  <textarea rows="20" cols="91" [style.font-size.px]="20" [style.padding-top.px]="130" readonly="textareaEdit" style="background-color: #b6b7b4;" [(ngModel)]="mainStepText"></textarea>
</div>

用於 textarea 的字符串

private labelText: String = "test1 \ntest2 \ntest3";

當前的 CSS

.mainWindow{
width: 1000px;
    height: 310px;
    vertical-align: middle;
    resize: none; 
    overflow: auto; 
    -ms-overflow-style: none; 
    background-color: #B5B6B6;
}
.valueOutput{
    position: absolute;
    resize: none !important;
    padding-left: 600px;
}
.labelOutput{
    position: absolute;
    resize: none !important;
    padding-left: 250px;
}
  1. 對於內聯 CSS,您可以將樣式更改為以下內容:
style="background-color: black;color:#fff;"
  1. 或者您可以在 CSS 文件中添加以下內容:
textarea {
  color: #fff;
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM