开发者

Is there a jquery plugin that columnizes list items horizontally rather than vertically?

开发者 https://www.devze.com 2023-01-15 12:13 出处:网络
I\'m looking for a jquery plugin or javascript that will columnize a list. I\'ve seen Columizer, which is great and the configuration options are just what I need, except that it doesn\'t columnize da

I'm looking for a jquery plugin or javascript that will columnize a list. I've seen Columizer, which is great and the configuration options are just what I need, except that it doesn't columnize data in the direction I need.

My list:

1.开发者_运维知识库 2. 3. 4. 5. 6. 7. 8. 9.

Columizer behavior I want:

1. 2. 3.
4. 5. 6.
7. 8. 9.

Columizer behavior I don't want:

1. 4. 7.
2. 5. 8.
3. 6. 9.


You don't need a jQuery plugin for that. Simply set the float property for the <li>s:

li {
    float: left;
}

Here's an example: http://jsfiddle.net/FgZ9N/


If you mean displaying list items in that fashion, no scripting is requried. setting a width on each list item, giving the list container element a width equal to the total columns, and using 'float:left' should do the trick


You could probably achieve this with CSS.

Assuming the list is in < ul>< li> format:

{
  display:inline-block;
  width:33%;
}

or use float:left; and then set clear:all; on every third one.

or something like that -- there's probably about a dozen ways to do this in CSS.

0

精彩评论

暂无评论...
验证码 换一张
取 消