非文本元素的CSS nowrap? [英] CSS nowrap for other than text elements?

查看:110
本文介绍了非文本元素的CSS nowrap?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当内容不仅仅是文本内容时,是否有避免包装 div
内容的方法?几个按钮?

解决方案

white-space:nowrap; should do the技巧。

< pre class =snippet-code-css lang-css prettyprint-override> #foo {white-space:nowrap; width:100px;}

< div id =foo > < input type =buttonvalue =hello/> < input type =buttonvalue =hello/> < input type =buttonvalue =hello/> < input type =buttonvalue =hello/> < input type =buttonvalue =hello/> < input type =buttonvalue =hello/> < input type =buttonvalue =hello/>< / div>

演示


Is there a way to avoid wrapping of a div's content when the content is not just text e.g. several buttons?

解决方案

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

这篇关于非文本元素的CSS nowrap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆