使html内容牢不可破(一行) [英] Making html content unbreakable (in one line)
问题描述
我有一条由input
和span
组成的线路,应该代表一个电话号码.将其插入具有某些内容的列的表中会导致该行中断:
I have a line made of input
s and span
s which should represent a phone number. Inserting it into a table with some columns with content causes the line to break:
最后一个输入被推入下一行.解决此问题的一种方法是设置固定的td
width
或min-width
.但是,为了将来的任何项目,我想知道是否有一种方法可以使html内容牢不可破,而无需触碰td
宽度.感谢您提供任何信息.
The last input is pushed into the next line. One way to fix this could be setting a fixed td
width
or min-width
. However, for the sake of any future projects I would like to know is there a way to make the html content unbreakable without touching the td
width. Thanks for any info.
推荐答案
将此CSS添加到td
Add this CSS to the td
white-space: nowrap;
这可以防止HTML自动换行.有关更多信息,请参见 MDN
This prevents the automatic line-breaking of HTML. For more info see MDN
这篇关于使html内容牢不可破(一行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!