在 html 中,如果我用这样的列创建一个 html 表
<table>
<tr>
<td>This is your ID</td>
<td>021-000-00001</td>
<td>...</td>
</tr>
</table>
空格和 - 会在渲染时造成多行。 所以对于空间,解决方案是:
<td>This is your ID</td>
但对于破折号 -,我什至将其替换为 —,比如
<td>021—000—00001</td>
它仍然显示为多行。
如何解决?
最佳答案
尝试类似的东西
<td style="white-space: nowrap;">021-000-00001</td>
这应该会阻止它在连字符处断开。
关于html: "-"和空格一样""?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1472708/