给盒子加contenteditable=“true“之后怎么改样式(继上篇div变textarea)

修改placeholder的样式

.txt-word:empty:before {
    padding: 10px;
    box-sizing: border-box;
    content: attr(placeholder);
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    line-height: 22px;
    color: rgba(178, 178, 178, 1);
}

.txt-word:focus:before {
    content: none;
}



之后会发现focus之后有白框:
在这里插入图片描述
修改默认focus之后自动添加白框的样式

.txt-word:focus{
    border:none;
    outline: none; 
}

完美的解决问题!!!

猜你喜欢

转载自blog.csdn.net/lqlq54321/article/details/110393929