设置div为textarea样式

2021-10-29  本文已影响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> 
上一篇 下一篇

猜你喜欢

热点阅读