我有一个 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/