admin管理员组文章数量:1289509
When editing an element with the contenteditable attribute I want the background color of that element to change colors. For example, if the element background color was dark grey I would want it to turn white while editing the element and then reset back to dark grey when done editing.
When editing an element with the contenteditable attribute I want the background color of that element to change colors. For example, if the element background color was dark grey I would want it to turn white while editing the element and then reset back to dark grey when done editing.
Share Improve this question asked Aug 1, 2013 at 21:13 Sunday1290Sunday1290 751 silver badge6 bronze badges2 Answers
Reset to default 9You can use this CSS:
[contenteditable="true"] {
background-color: grey;
}
[contenteditable="true"]:focus {
background-color: white;
}
Here's the JSFiddle.
Use something like this.
[contenteditable]:focus {
background: #fff;
}
本文标签: javascriptContenteditablechange background color when editingStack Overflow
版权声明:本文标题:javascript - Contenteditable--change background color when editing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741464802a2380248.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论