CSS nowrap不是文本元素?

cur*_*4so 22 html css html5 nowrap

div当内容不仅仅是文本,例如几个按钮时,有没有办法避免包装内容?

sac*_*een 30

white-space:nowrap; 应该做的伎俩.

#foo {
  white-space:nowrap;
  width: 100px;
}
Run Code Online (Sandbox Code Playgroud)
<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>
Run Code Online (Sandbox Code Playgroud)

演示