最佳实践:表,Div,列表或某种组合...? [英] Best Practice: Table, Div, List or some combination...?

查看:102
本文介绍了最佳实践:表,Div,列表或某种组合...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的数据表,行少于100行。我目前一直在一系列嵌套的DIV中显示数据。每行都有一个容器div,嵌套的div表示其中的数据列。 (这是从我最早的编码日起,当没有像div这样的东西时)的反应。



第一列数据被格式化为图片链接,而另外两列是文本。



返回使用表格有意义吗?

另外,作为一个实验,我曾想过使用嵌套UL。包含所有行的UL,以及每行的单独水平UL。

作为进一步的注释/问题,我有另一个数据块,可能导致数千的行。在这种情况下,数据量是否会导致最佳实践的不同答案?解析方案

现实地,您可以使用任何你想要的容器。最佳做法是将这些元素用于他们的用途。如果您正在显示表格数据,请使用表格!有很棒的插件可以更好地为用户提供体验,而且阅读和复制/粘贴非常简单。

我总是问自己的问题是,如果这些数据最好显示在Word或Excel文件中。如果是Excel,那么它就是一张桌子。如果是Word,它是div的。



如果您使用的是数千行,您可能想让用户控制排序,筛选和提供更多信息给帮助可用性。我会使用一个包含tablesorter,hovertable和tableFilter等jQuery插件的表来帮助简化这一过程。


I have a simple datatable with less than 100 rows. I've currently been displaying the data in a series of nested DIVs. Each row has a container div, with nested divs representing the columns of data within it. (This was in reaction from my earliest coding days when there wasn't anything like a div).

The first column of data is formatted as an image link, while the other two columns are text.

Does it make sense to return to using a table?

Also, as an experiment, I'd thought about using nests ULs. An UL to contain all the rows, and a separate horizontal UL for each row.

As a further note/question, I have another block of data that can result in thousands of rows. Would that amount of data result in a different answer for 'best practice' in this case?

解决方案

Realistically, you can use any container you'd like. Best practice is to use the elements for what they were meant to be used for. If you are displaying tabular data, by all means use a table! There are great plugins to make the experience for the user better, and it's really easy to read and copy/paste.

The question that I always ask myself is if that data would be best shown in a Word or Excel file. If Excel, then it's a table. If Word, it's div's.

If you're using thousands of rows you'll probably want to give the user control on sorting, filtering, and pulling in more information to aid usability. I'd use a table with some jQuery plugins like tablesorter, hovertable and tableFilter to help make this easy.

这篇关于最佳实践:表,Div,列表或某种组合...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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