自动换行不让数字也自动换行 [英] word wrap does not let the numbers wrap also
本文介绍了自动换行不让数字也自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这种有效的表格,唯一的事情是当用户在文本框数字中输入很多数字时
I have this form which is working The only thing is when user enters a lot of digits into the textbox numbers
示例:
12345678
3567892
1235674
36778883
566666678
35674748999
// with no spaces
它不想包装.我在网上四处张望,只显示了如何包装文字.
It does not want to wrap. I looked all over the net it only shows how to wrap text.
<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指定表格的宽度.
Try to designate a width of the table thru 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>
这篇关于自动换行不让数字也自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文