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?
HTML:
<textarea rows="10" cols="20" id="text"></textarea>
CSS:
#text
{
overflow-y:scroll;
}
like this
css
textarea {
overflow:scroll;
height:100px;
}
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*/
}
Source: Stackoverflow.com