1

Possible Duplicate:
I want to show list items as 2 or more columns (dynamic alignment)

Sorry for my English!

I have a problem with ul li:

my HTML:

<ul>

    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
    <li>6</li>
    <li>7</li>
    <li>8</li>
    <li>9</li>
    <li>10</li>
</ul>

my css:

ul {
width:60px;

}

ul li{
float:left;
width:20px;
list-style:none;
}

my list is divided into 3 columns like:

1 2 3
4 5 6
7 8 9
10

So, my question is: how can I sort my list like :

1 4 7 10
2 5 8
3 6 9

Thanks for any help:D

Community
  • 1
  • 1
JaclBlack
  • 237
  • 1
  • 2
  • 10

4 Answers4

3

You can use css3 column-count property for this check this for more

I want to show list items as 2 or more columns (dynamic alignment)

Community
  • 1
  • 1
sandeep
  • 91,313
  • 23
  • 137
  • 155
1

See fiddle for code and demo

Fiddle: http://jsfiddle.net/pGHCd/

Demo: http://jsfiddle.net/pGHCd/embedded/result/

ss:

enter image description here

w3uiguru
  • 5,864
  • 2
  • 21
  • 25
0

CSS3 to the rescue!

ul {
    width:60px; height: 60px;
}

ul li{
    float:left;
    width:20px;
    list-style:none;
}
ul, ul li {
    -moz-transform: rotate(-90deg) scaleX(-1);
    -o-transform: rotate(-90deg) scaleX(-1);
    -webkit-transform: rotate(-90deg) scaleX(-1);
    -ms-transform: rotate(-90deg) scaleX(-1);
    transform: rotate(-90deg) scaleX(-1);
}

http://jsfiddle.net/rlemon/Y5ZvA/2/

rlemon
  • 17,518
  • 14
  • 92
  • 123
0

Hi you can do this on css3 properties as like this

Css

ul{
    -moz-column-count: 3;
    -moz-column-gap: 33%;
    -webkit-column-count: 3;
    -webkit-column-gap: 33%;
    column-count: 4;
    column-gap: 33%;
    background:green;
    width:100px;

}
li{
    height:20px;
    list-style:none;
}

HTML

<ul>

    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
    <li>6</li>
    <li>7</li>
    <li>8</li>
    <li>9</li>
    <li>10</li>
</ul>
​

Live demo http://jsfiddle.net/rohitazad/pMbtk/376/

But is not work IE

Rohit Azad Malik
  • 31,410
  • 17
  • 69
  • 97