我有这个正在工作的表单唯一的事情是当用户在文本框数字中输入很多数字时
Example:
12345678
3567892
1235674
36778883
566666678
35674748999
// with no spaces
它不想包裹。我查遍了整个网络,它只显示了如何换行文本。
<html>
<?php
require_once("connect.php");
$stmt = $db->prepare("SELECT * FROM numbers");
$stmt->execute();
?>
<?php while( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) { ?>
<table border='1'table-layout: fixed >
<br>
<tr>
<th>Id</th>
<th>numbers</th>
</tr>
<tr>
<td style="word-wrap: break-word;"><?php echo $row['numbers']; ?></td>
</tr>
<?php } ?>
</table>
</body>
</html>
尝试用css指定表格的宽度。
<table border="1" style="table-layout: fixed; width: 150px;">
<tr>
<th>Id</th>
<th style="word-wrap: break-word;">numbers</th>
</tr>
<?php while( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) { ?>
<tr>
<td style="word-wrap: break-word;"><?php echo $row['id']; ?></td>
<td style="word-wrap: break-word;"><?php echo $row['numbers']; ?></td>
</tr>
<?php } ?>
</table>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)