I am trying to ensure that the textarea does not exceed the original length of the page, eliminating the need for a scrollbar to view the entire content.
Currently, I am implementing the solution provided in response to this query using flexbox to make it adjust its height dynamically.
At present, the text area extends beyond the original size, resulting in a scrollbar appearing and requiring scrolling to view all content.
html, body {
height: 100%;
margin: 0;
}
input[type=text]{
width: 100%;
font-size: 32px;
border: 3px solid #999;
padding: 12px 20px;
margin: 5px 10px;
box-sizing: border-box;
flex: 0 1 auto;
outline: none;
}
div {
display: flex;
}
.fillspace {
display: flex;
height: 100%;
}
input[type=text]:focus{
border: 3px solid #555;
}
button {
background-color: #0099cc;
border: none;
color: white;
text-align: center;
padding: 16px 32px;
text-decoration: none;
display: inline-block;
font-size: 32px;
margin: 5px 10px 5px 0;
}
button:hover{
background-color: #007399;
outline: none;
}
button:active{
background-color: #007399;
}
textarea{
outline: none;
resize: none;
font-size: 32px;
border: 3px solid #999;
padding: 12px 20px;
margin: 5px 10px 10px 10px;
box-sizing: border-box;
width: 100%;
height: 100%;
flex: 1 1 auto;
}
textarea:focus{
border: 3px solid #555;
}
h1{
text-align: center;
font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
}
<body>
<h1>Command Queue</h1>
<div>
<input placeholder="Type command here" type="text"/>
<button>Run</button>
</div>
<div class="fillspace">
<textarea id="commandOutput">{{.}}</textarea>
</div>
</body>