文本区域滚动条

发布于 2025-01-02 20:10:44 字数 387 浏览 2 评论 0原文

我希望以下文本区域在 text.txt 中的内容填满超过文本区域窗口时允许滚动。另外,我希望它自动滚动到文本区域字段的底部。这可能吗?

<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>

谢谢。

I want the following textarea to allow scrolling when the stuff inside text.txt fills up more than the textarea window. Also, I want it to auto scroll to the bottom of textarea field. Is this 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>

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拥抱没勇气 2025-01-09 20:10:44

这是 CSS,它将确保您在文本太多时获得垂直滚动条:

overflow: auto;

对于滚动到文本区域的底部,显然您需要 JS。
请参阅此问题

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

overflow: auto;

For scrolling to bottom of textarea, clearly you need JS for that.
See this problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文