Contenteditable 设置placeholder属性 发表于 2019-11-28 更新于 2024-04-07 HTML<div class="textarea" contenteditable="true" placeholder="请输入补充说明"></div> CSS.textarea { width: 100%; min-height: 210px; &:empty:before { content: attr(placeholder); //设置attr属性,使placeholder属性生效 color: rgba(170, 159, 159, 1); } &:focus:before{ content:none; } }