CSS:将新行放在上面,而不是下面 [英] CSS: Make new line go above, not below

查看:122
本文介绍了CSS:将新行放在上面,而不是下面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 div 有一些浮动的孩子。当 div 的宽度变满时,它继续到新行 第一行(这是正常的预期行为)。 JSFiddle显示我在说什么



我希望继续使用高于第一行,而是继续流程。只有 CSS 可以实现这一点吗?

编辑:这是一个新链接,其中包含它的作用和我想要的操作



EDIT2: http://jsfiddle.net/YnKzL/ =nofollow>这里是一个更多元素的示例

解决方案

向子元素添加 clear:both; 。这将强制每个孩子使用自己的行。



http ://jsfiddle.net/e7qde/6/



更新:



http://jsfiddle.net/e7qde/12/


I have a div that has some floated children. When the div's width becomes full, it continues to a new line, below the first line (which is the regular, expected behavior). JSFiddle to show what I am talking about.

I want it continue onto a new line above the first line instead following the flow. Is this possible with just CSS? How can I achieve this?

EDIT: Here is a new link with what it does and what I want it to do

EDIT2: Here is an example with more elements

解决方案

Add clear: both; to the child elements. That will force each child to it's own line.

http://jsfiddle.net/e7qde/6/

Update:

http://jsfiddle.net/e7qde/12/

这篇关于CSS:将新行放在上面,而不是下面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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