有没有办法避免 div
的换行
当内容不仅仅是文本时的内容,例如几个按钮?
最佳答案
white-space:nowrap;
应该可以解决问题。
#foo {
white-space:nowrap;
width: 100px;
}
<div id="foo">
<input type="button" value="hello"/>
<input type="button" value="hello"/>
<input type="button" value="hello"/>
<input type="button" value="hello"/>
<input type="button" value="hello"/>
<input type="button" value="hello"/>
<input type="button" value="hello"/>
</div>
关于CSS nowrap 用于文本元素以外的其他元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15857321/