美文网首页
设置div为textarea样式

设置div为textarea样式

作者: 翔子丶 | 来源:发表于2021-10-29 13:51 被阅读0次
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .textarea {
      min-height: 100px;;
      height: 200px;
      max-height: 400px;
      width: 300px;
      padding: 4px;
      border: 1px solid #888;
      border-radius: 4px;
      resize: vertical;
      overflow: auto;
    }
    .textarea:empty:before {
      content: attr(placeholder);
      color: #bbb;
    }
  </style>
</head>
<body>
  <div class="textarea" contenteditable placeholder="请输入内容..."></div>
</body>
</html> 

相关文章

网友评论

      本文标题:设置div为textarea样式

      本文链接:https://www.haomeiwen.com/subject/tguialtx.html