Textarea scrollbar

I want the next text area to allow scrolling when the content inside text.txt is filled more than the textarea window. In addition, I want it to automatically scroll to the bottom of the textarea field. Is it possible?

<textarea class="textarea" id="textarea" readonly="readonly" " rows="20">
      <?php
      //$date=date(dmY);
      $file = fopen("text.txt", "r");

      while(!feof($file)){
         echo fgets($file);
      }
      fclose($file);
    ?>
    </textarea>

Thank.

+5
source share
1 answer

This is CSS that will allow you to get a vertical scrollbar when there is too much text in the text:

overflow: auto;

To scroll to the bottom of the text area, obviously you need JS for this. See this problem .

+6
source

All Articles