使html内容牢不可破(一行) [英] Making html content unbreakable (in one line)

查看:80
本文介绍了使html内容牢不可破(一行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一条由inputspan组成的线路,应该代表一个电话号码.将其插入具有某些内容的列的表中会导致该行中断:

I have a line made of inputs and spans which should represent a phone number. Inserting it into a table with some columns with content causes the line to break:

最后一个输入被推入下一行.解决此问题的一种方法是设置固定的td widthmin-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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆