簡體   English   中英

如何更改 Div 中占位符的顏色?

[英]How to change the color of Placeholder in Div?

我有點堅持要更改 div 中占位符的顏色。 我正在使用 VueJs 將占位符與我的 div 元素綁定。 這是前端:

在此處輸入圖片說明

VueJs 代碼:

<div class="new-message-input form-control" id="plc" contenteditable :data-placeholder="$t('chat.type_a_message')" :placeholder="$t('chat.type_a_message')" ref="newMessageInput" @keydown="isTyping" @keydown.enter="enterPressedEvt(postMessage, $event)">

代碼:

#plc::placeholder { 
  color: white;
}

 #plc{ padding: 10px; background-color: orange; } [contentEditable=true]:empty:not(:focus):before{ content:attr(data-text); color: white; }
 <div id="plc" contentEditable=true data-text="Type a message..."></div>

暫無
暫無

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

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