繁体   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