2010-07-26 143 views

回答

0

容器1,2,5,和6应该在一个div,和容器3和4应在一个div。浮动THOSE divs。

+0

Stefan,谢谢你的回答,但是这个DIVS是通过PHP产生的,我不能将div嵌入到其他div中。 再次感谢您的回复。 – user402373 2010-07-26 20:58:05

+0

你说的没有任何意义。 – 2010-07-26 23:28:43

2

它看起来像DIV与“容器5”有一个clear:left;clear:both;设置在CSS中。

编辑

没关系,你把所有的div向左浮动。下面是一些示例代码:

Sample Code on jsfiddle.net

如果用窗口的宽度玩,你会注意到的div将尝试填补所有可用的水平空间。你看到的混乱结果来自不同垂直高度的div。你会得到想要的结果,如果:

  1. They all had the same height(即它们都具有2行文字)
  2. You assigned a height value to each div with height:90px;(将其设置为最大的共同点)
  3. 或者you decided to only have 3 columns of divs max,即使浏览器窗口宽足以容纳更多。他们可以把容器1,2,& 3放在一个div上面,而容器4,5,& 6在另一个div下面
  4. 最后(为了完整性),you can put container 1 & 4 in a div, container 2 & 5 in a div, and container 3 & 6 in a div, and then float those divs left。这也会给你3列,但它太严格了,我不推荐它(you can also set the height on the floated divs for better alignment)。

选项#2是我的最爱。

+0

嗨! 感谢您的回答。 真的,你提出的例子并不是我想要的那样。 我想叠加德DIVS作为我附加的图像相同的方式。 没有空隙和不对称的方式,在所有DIVS中都会产生高度自动。 无论如何。 CoolBurn。 – user402373 2010-07-26 18:41:12