gpt4 book ai didi

php - 如何使用 PHP 使我的输出文本可滚动?

转载 作者:太空宇宙 更新时间:2023-11-04 13:55:17 25 4
gpt4 key购买 nike

我试图从 $data 回显的文本太长了,超出了表格的边界,超出了屏幕范围。除此之外,所有文本的显示都没有换行符(或空行)或适当的间距。

我的简单 PHP 代码:

<div id="sampleid1" class="tabcontent" style="margin-left:48px;">
<table width="510" border="0" cellspacing="4" cellpadding="4" class="SampleClass">
<tr>
<td>
<?php echo Sample1_LABEL;?>
</td>
<th align="left"><strong>:</strong>
</th>
<td>
<?php echo $data[ 'Sample1'];?>
</td>
</tr>
<tr>
<td>
<?php echo Sample2_LABEL;?>
</td>
<th align="left"><strong>:</strong>
</th>
<td>
<?php echo $data[ 'Sample2'];?>
</td>
</tr>
</table>
</div>

总结:

  1. 我需要使用 $data 检索的文本以这样一种方式进行格式化,即换行符在回显时显示在输出中。
  2. 我需要输出文本可以滚动,这样文本就不会超出屏幕范围。

最佳答案

您需要将 CSS 设置为您回显 $data 的 TD 标记...

<td style="height:150px; overflow-y:scroll;">

我的错误.. TD 不接受溢出所以你可以这样做::

<td style="height:150px"><div style="height:100%; overflow-y:scroll;">..PHPCODE...</div></td>

关于php - 如何使用 PHP 使我的输出文本可滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12995432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com