1. ホーム
  2. html

[解決済み] Add a scrollbar to a <textarea> [duplicate]

2022-02-07 04:04:18

Question

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.

どうすればいいのでしょうか?

どのように解決するのですか?

必要なものは overflow-y: scroll;

デモ

    textarea {
        overflow-y: scroll;
        height: 100px;
        resize: none; /* Remove this if you want the user to resize the textarea */
    }
<textarea></textarea>