开发者

Is it ok to still use tables? [duplicate]

开发者 https://www.devze.com 2023-01-27 18:54 出处:网络
This question already has answers here: Closed 12 years ago. Po开发者_运维百科ssible Duplicate: Why not use tables for layout in HTML?
This question already has answers here: Closed 12 years ago.

Po开发者_运维百科ssible Duplicate:

Why not use tables for layout in HTML?

Just wondering, I thought I have read before that it is bad to use tables, so my question is, is it still acceptable to use tables in development?


If you're presenting tabular data, it's fine to use tables. If you're doing layout, it's usually easier and lighter to use a few divs (and use a CSS framework like YUI or Blueprint) to do your work.


Yes. Tables are very good (even preferred) for tabular data.

For layout alone, there are newer and better options such as CSS Grid.


Tables work best for tabular data - if you are showing results of some query, like a list of customers or transactions or currency values, go ahead, you should be using tables.

What is bad is using tables for layout where the logical orger is not left-to-right i.e. if you have a navigation pane on the left, do you want to read the navigation before the content? probably not...

However if you have a form with labels and input fields do you want to read the label before the input control, yes, you probably do.

The reason for this is that screen readers and similar assistive technologies force this order on their users. also it is usually much harder to read the resultant HTML when you use tables for layout


If you have a lot of tabular data, it makes sense to use tables. Example: Suppose, you want to display a list of baseball players and their batting averages.


Use it for tabular data, but not for creating page layout.

0

精彩评论

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