html - 如何防止自动换行

标签 html css

我有一个 200px 宽度的 div 和一些文本,如果文本超过 200px,我应该如何防止自动换行?

<div style="overflow:hidden; width:200px;">
   Long text
</div>

最佳答案

只需使用 css 属性

<div style="overflow:hidden; width:200px; white-space:nowrap">
   Long text
</div>

关于html - 如何防止自动换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18443247/

相关文章:

javascript - ngFor 中的复选框,每次单击任何其他复选框时,只有第一个复选框被选中和取消选中

html - 我如何使这个渐变透明?

javascript - 带有 jQ​​uery each() 的 Slick Slider 背景图像循环

javascript - 使用 jQuery 覆盖内联 CSS 应用了一段时间,然后就消失了。为什么?

javascript - jQuery 删除多个样式

javascript - 无法从未定义中读取属性 "texture"

javascript - 如何在页面 Page.IsPostBack 之后禁用 JavaScript 函数

html - 带有 HLS 流式传输的 AES128

html - 溢出隐藏的绝对div

javascript - 我的网站搜索表单的输入字段不接受输入