div 的 placeholder

给 div 传递 placeholder 即可

  .editor {
    width: 100%;
    height: 100%;
    outline: none;
    border: 1px solid #cacdd4;
    border-radius: 5px;
    box-sizing: border-box;
    overflow-y: auto;
    padding: 0 5px;
    &:empty::before {
      content: attr(placeholder);
      font-size: 12px;
      color: #cacdd4;
    }
    &:focus:before {
      content: none;
    }
  }
posted @ 2023-07-31 15:20  DL·Coder  阅读(52)  评论(0编辑  收藏  举报