I have encountered a difficulty and don't know how to achieve it. I hope everyone can give me a little help!
The problem is this!
I'm making a textarea. I hope that the height of the input box will be 36px at the beginning, but if the text continues to be input, the height of the input box can be increased to 72px, but the maximum height is 72px, and it will not increase with the increase of text. high!
The above is what I want to achieve, because I am just learning the program, I don’t know if this can be done through CSS or I need to use javascript? How to achieve this requirement through javascript?
Thank you all for coming to my question and for helping me. Thank you all.
body {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.demo {
width: 600px;
padding: 16px;
border: 1px solid #222;
}
.demo .tool {
display: flex;
list-style-type:none;
}
.demo .tool li {
padding: 16px;
background-color: #ccc;
border: 1px solid #222;
}
.demo .chat {
margin-top: 16px;
width: 600px;
height: 36px;
}
.demo .tool__footer {
margin: 16px;
}
.demo .tool__footer .send {
text-decoration: none;
padding: 8px;
background-color: #f9cf5a;
color: #222;
border-radius: 6px;
}
<div class="demo">
<div class="wrap">
<ul class="tool">
<li>photo</li>
<li>file</li>
<li>example</li>
</ul>
<textarea class="chat"></textarea>
<div class="tool__footer">
<input type="checkbox" id="enter"><label for="enter">ENTER</label>
<a type="text" class="send" href="javascript:;">send</a>
</div>
</div>
</div>