开发者

Any way to force divs to group up?

I have a series of floating divs without set height arranged so that three fit across the screen. With set height they stay like a tabular layout but if the text in one is longer than the text in another the boxes split up in an odd way.

Is there any way to force the boxes to group up so that the margin between the sides of any two subsequent divs will be enforced or do开发者_高级运维 I just have to set a specific height?


Is this something similar to what you want?

http://jsfiddle.net/9xpja/

It's using display: inline-block and vertical-align: top.

If what you mean is to have them all fit in like blocks then you'll need to do something like the other solutions posted by others by creating "columns".


You can try to put each column in a seperate div, that way you'll get rid of the gaps. But the divs wont be align to each other anymore.


You could always add the three column divs inside a parent row div. Then just set the vertical alignment of the parent div. That will cause them to conform and "Group Up".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜