This question already has answers here:
Closed 6 years ago.
I would like to add a scrollbar to a textarea, so that it always appears, even when there is nothing to scroll down to. If there is nothing for it to scroll down to, I would prefer if it could be greyed out, indicating that there is nothing below.
How would I do this?
What you need is overflow-y: scroll;
Demo
textarea {
overflow-y: scroll;
height: 100px;
resize: none; /* Remove this if you want the user to resize the textarea */
}
<textarea></textarea>
Try adding below CSS
textarea
{
overflow-y:scroll;
}
You will need to give your textarea a set height and then set overflow-y
textarea
{
resize: none;
overflow-y: scroll;
height:300px;
}
textarea {
overflow-y: scroll; /* Vertical scrollbar */
overflow: scroll; /* Horizontal and vertical scrollbar*/
}
like this
css
textarea {
overflow:scroll;
height:100px;
}
HTML:
<textarea rows="10" cols="20" id="text"></textarea>
CSS:
#text
{
overflow-y:scroll;
}