1

I have a list of items that I want to display evenly in alphabetic order (from top top to bottom) in three columns. Is it possible to manage this with css only?

With the example code below the three columns would contain following amount of items: 3/3/2.

<div class="content">
  <div class="list_container">
    <div class="list_item">Adis Abeba</div>
    <div class="list_item">Amsterdam</div>
    <div class="list_item">Beijing</div>
    <div class="list_item">Buenos Aires</div>
    <div class="list_item">Johannesburg</div>
    <div class="list_item">Mexico City</div>
    <div class="list_item">Paris</div>
    <div class="list_item">Stockholm</div>
  </div>
</div>

Demo: http://jsfiddle.net/BERSp/1/

Fellow Stranger
  • 32,129
  • 35
  • 168
  • 232

2 Answers2

7

You need column-count or mansonry javascript: http://jsfiddle.net/BERSp/2/

.content {
    width: 500px;
    border:1px solid #111;
    padding: 10px;
}
.list_container {
    overflow:hidden;
    -webkit-column-count:3;
    -moz-column-count:3;
    -o-column-count:3;
    column-count:3;
}

Javascript usefull : http://masonry.desandro.com/

G-Cyrillus
  • 101,410
  • 14
  • 105
  • 129
1

For the 3 columns, just set width to 33%:

.list_item {float:left; display: block;width:33%}
javitube
  • 91
  • 1
  • 2