如何让一个html表分成两个部分,并排? [英] How to have one html table split into two sections, side by side?

查看:1840
本文介绍了如何让一个html表分成两个部分,并排?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个表格,其中显示一半的行,然后换行并显示其旁边的水平行的另一半行,而不是一个长的垂直表。

I want to have one table which will display half the rows, then wrap and display the other half of the rows next to it horizontally instead of having one long vertical table.

我使用角度和希望能够绑定一个数据数据到一个表,但它有水平横跨两个部分,如描述。两个表是一个选项,但它意味着我必须添加更多的逻辑,我希望尽可能避免。

I'm using angular and want to be able to bind one array of data to one table but have it span two sections horizontally like described. Two tables is an option but it means I'll have to add much more logic which I'd prefer to avoid if possible. i.e. For sorting Id have to join the datasets back together and sort them, before splitting again.

任何指针都赞赏。

推荐答案

您可以尝试使用 CSS3多栏布局。这通常不适用于表(并且它不直接与表一起使用),但是如果将表放置到具有类似

You can try playing with CSS3 multi-column layouts. This usually doesn't apply to tables (and it doesn't work directly with tables), but if you place your table into a DIV container with style like

#container {
    column-count:2;
    -moz-column-count:2;
    -webkit-column-count:2;
}

这可能是你需要的。

演示: http://jsfiddle.net/J3VB5/

Demo: http://jsfiddle.net/J3VB5/

更新:上述内容似乎只适用于WebKit浏览器(Chrome,Opera,Safari)。 FF / IE可能需要不同的方法。

Update: the above seems to work only in WebKit browsers (Chrome, Opera, Safari). FF/IE may require a different approach.

例如,您可以使用 Columnizer jQuery plugin

演示2: http ://jsfiddle.net/J3VB5/1/

Demo 2: http://jsfiddle.net/J3VB5/1/

这篇关于如何让一个html表分成两个部分,并排?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆