Is there a way to avoid wrapping of a div
's
content when the content is not just text e.g. several buttons?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
white-space:nowrap;
should do the trick.
#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>
Demo
回答2:
You can set both these properties in CSS:
white-space:nowrap;
and max-width:something;
回答3:
You can declare static positions for the other contents using
position:absolute;