div变成输入框
<style> #test{ width: 150px;; min-height:20px; max-height:70px; outline: 0; border: 1px solid #000; font-size: 13px; overflow-x: hidden; overflow-y: auto; -webkit-user-modify: read-write-plaintext-only; } [contentEditable=true]:empty:not(:focus):before{ content:attr(data-text); } </style> </head> <body> <div id="test" contenteditable="true" data-text="输入留言"></div> </body>