简体   繁体   English

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

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

I am a bit stuck to change the color of the Placeholder in div.我有点坚持要更改 div 中占位符的颜色。 I am using VueJs to bind placeholder with my div element.我正在使用 VueJs 将占位符与我的 div 元素绑定。 Here is the front-end :这是前端:

在此处输入图片说明

VueJs Code : 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)">

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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