布局(浮动)与css不同的高度块

时间:2014-03-27 06:48:50

标签: html css css3

我有这样的div,有这样的html,就像这里:

http://pastebin.com/Xt2Ws2EU

和小css:

#manufacturers-list{
  width: 690px;
  height: 980px;
  max-height: 980px;
  margin: 10px 0 0 0;
  .man-area{
    margin: 6px 0 0 6px;
    width: 210px;
    float: left;
    ul, li{
      margin: 0;
      padding: 0 0 0 1px;
      list-style-type: none;
    }
    ul{
      padding: 0 0 0 10px;
    }
  }
  // *:nth-child(3n+1) {
  //    clear: both;
  // }
}

在模式中它看起来如此(离开我有红叉的地方):

enter image description here

所以一切都浮出水面,但是新的元素线只是在架构之后的大多数最大高度块之后,但是我需要设置样式,那些块在没有最大高度块的情况下浮动,我怎么能这样做没有js?只用css?

1 个答案:

答案 0 :(得分:1)

结帐post

HTML

<div>
    <a href="#">Whatever stuff you want to put in here.</a>
    <a href="#">Whatever stuff you want to put in here.</a>
    <a href="#">Whatever stuff you want to put in here.</a>
</div>

CSS

div{
    -moz-column-count: 3;
    -moz-column-gap: 10px;
    -webkit-column-count: 3;
    -webkit-column-gap: 10px;
    column-count: 3;
    column-gap: 10px;
    width: 480px;
}

div a{
    display: inline-block;
    margin-bottom: 20px;
    width: 100%;
}