C
C
Chvanikoff2011-03-09 19:35:39
css
Chvanikoff, 2011-03-09 19:35:39

Multi-column ul/li layout?

Hello!
There was a task — to break the big (about 100 elements) the ul/li list into several columns. But the task doesn’t end there…
You need to do something wrong:
1 2 3
4 5 6
7 8 9
And like this:
1 4 7
2 5 8
3 6 9
Google doesn’t give out the secrets of implementing what I need – only the first option…
Tell me, please , implementation.

Answer the question

In order to leave comments, you need to log in

12 answer(s)
Y
Yeah, 2011-03-10
@Yeah

You can also come up with such a CCS3 solution:

li {
  float:left;
}
li:nth-child(3n+1) {
  clear:both;
}

A
Arthur Koch, 2011-03-09
@dudeonthehorse

If the list is obtained by means of an array, then it is not difficult to split the array into 3 lists, and there is no need to do anything weird. If it is static, then we simply typeset three lists of the ul type.

S
sirponch, 2011-03-10
@sirponch

Here is a solution from Samiznaetekos studio: bit.ly/Cdsz8

M
Mikhail Kobzarev, 2011-03-29
@mihdan

jQuery: Split list into columns (and my comment is a must).

A
anike_rich, 2015-06-29
@anike_rich

Here is a solution Creating a list in the form of blocks in several columns

P
pomeo, 2011-03-09
@pomeo

maybe something like kenneth.kufluk.com/google/js-columns/
code.google.com/p/js-columns/
googled "jquery newspaper layout"

S
Sergey Ermakov, 2011-03-09
@blew

Realistic in css3, but only webkit and mozilla support multi-column layout.

M
MT, 2011-03-09
@MTonly

If "validity" is important, then it remains only to break it into three separate lists. A smart option - the free use of DIV inside UL, OL and DL - has not yet been officially accepted (although it works in browsers): alas, formally only LI can still be the direct descendants of UL .

I
Ivan Klimchuk, 2011-03-10
@Alroniks

The other day I implemented this in XSLT. There, too, I suffered. In pure HTML, some kind of script is needed, otherwise there is no way. Or dynamically form lists from the server correctly.

J
Jazzist, 2011-03-10
@Jazzist

Given a limit on the number of rows or columns?
It's easy to do with jQuery.

M
Mad-cote, 2015-10-05
@Mad-cote

Try using flex. Here is a link to use this wonderful thing. Well, the solution above is good, using column.
Here's more goodies for you, you can see what is supported and by which browsers. It is enough to register the name of the property in the search.

G
Galyanoff, 2016-06-09
@Galyanoff

I am using this script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question