简体   繁体   中英

How to change the color of Placeholder in Div?

I am a bit stuck to change the color of the Placeholder in div. I am using VueJs to bind placeholder with my div element. Here is the front-end :

在此处输入图片说明

VueJs Code :

<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)">

Css Code :

#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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM