2023-03-07 10:23:52 版本 : contenteditable修改选中样式边框颜色(可编辑html)
作者: 系统管理员1 于 2023年03月07日 发布在分类 / 二次开发 / 前台 / 其他 下,并于 2023年03月07日 编辑
 历史版本

备注 修改日期 修改人
创建版本 2023-03-07 10:23:52[当前版本] 系统管理员1

1、contenteditable="true"可编辑

  <div contenteditable="true"></div>

或者用js

var div = document.getElementById('el');
var ele = document.createElement('div');
ele.id = 'inputelement';
ele.style.display = 'inline-block';
ele.style.border = 'none';
ele.style.minHeight = '100px';
ele.style.maxHeight = '100px;';
ele.style.padding = '10px';
ele.style.fontSize = '12px';
ele.style.color = 'blue';
ele.setAttribute('contentEditable', 'true');
div.appendChild(ele);
ele.focus();

2、修改边框颜色

[contenteditable]{
  outline: 1px solid transparent; 
  border: 1px solid #fff;width: 100%;
}
[contenteditable]:focus{
  border: 1px solid #00c0ef; 
  border-radius: 3px;
}

历史版本-目录  [回到顶端]
    wcp知识库系统-京ICP备15024440号-1 -V 5.1.9 -wcp