p.test(contenteditable=true) hello world .test { position: relative; outline: none; font-size: .26rem; &:empty::before{ content: '请输入您要说明的要求'; color: #ccc; } &:focus::before { // 聚焦后输入的内容删除内容为空时还需要提示语不需要这一句 content: none; } }
记录一下contenteditable属性的使用
最新推荐文章于 2024-01-29 09:51:13 发布