表格数据的 Div 与 Table
是的,另一个 div 与表格问题...
我到处读到“尝试使用 div 而不是表格”,但我有一个显示表格数据的应用程序,基本上我的整个 Web 应用程序显示表格(具有不同的列)和数据)但一切都是表格......我应该使用斗争来使用div吗?如果是,为什么?
Yes, another divs vs tables questions...
I read all over the place that "try to use divs instead of tables", but I have an application that displays data that is tabular, basically my entire web application displays tables (with different columns and data) but everything is tabular... Should I use struggle to use divs? If yes, why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
使用表格来获取表格数据。当桌子仅用于布局目的时,就会受到冲击。他们有自己的目的,那就是表格数据。 Div 没有语义意义,不应用于表格数据。
Use tables for tabular data. The knock against tables has been when they've been used solely for layout purposes. They have their own purpose, and it's tabular data. Divs have no semantic meaning, and shouldn't be used for tabular data.
不!
如果您的代码根本不使用表格,那么它们就会被删除。表格有其正确的用途,而且是用于表格数据!现在是使用它们的时候了(不是用于演示或设计)。所以无论如何,使用表格!
我建议在表格中提供标题标签,以便为可能使用屏幕阅读器的人(例如盲人网上冲浪者)提供适当的上下文。
示例:
不要害怕当前的趋势。表格应该用于表格数据。您做得对:)
深入了解辅助功能还提供了许多有用的提示。
No!
If tables were not to be used at all for your code, they would have been taken out. Tables have a proper use, and that use is for tabular data! This is the time to use them (not for presentation or design). So by all means, use tables!
I would recommend to provide a caption tag within your tables to give people who may be using screen readers (such as blind Web surfers) proper context, too.
Example:
Don't be afraid of current trends. Tables should be used for tabular data. You're doing it right :)
Dive Into Accessibility offers a lot of helpful tips, as well.
用 CSS 正确标记的表格没有任何问题。对于表格数据,表格是自然的选择,不要尝试使用 div 来模拟它们;除了少数情况下 div 可以更干净。
Div 和表格都只是您可以使用的工具。了解何时为正确的工作应用正确的工具。
There is nothing wrong with tables correctly marked with CSS. For tabular data, tables are natural choice, don't try to emulate them using divs; except in few cases where divs can be cleaner.
Divs and tables are both just tools at your disposal. Learn when to apply right tool for the right job.
不,您必须使用表格来存储表格数据!表格就是为了这个目的而存在的,您必须使用 div 来避免表格仅用于布局目的。
No, you MUST use tables for tabular data! Tables exist for that purpose, you MUST avoid tables only for layout purposes by using divs instead.
不要使用表格作为“布局”,因为您已经在网上找到了很多原因。
但为了显示“数据”,您仍然可以使用表格。
大多数服务器端脚本语言(例如 ASP.NET)都会为 gridView 生成表格,因此它们并不是“使用绝对错误”。
对于布局,我建议您浏览人们在 CSS Zen Garden 中为“单一 HTML”设计的不同有趣布局。
Don't use tables for your "LAYOUT" because of many reason you've already found on web.
But for displaying "DATA" you still can use tables.
most of server side scripting languages like ASP.NET generate tables for gridViews so they are not "Absoutely wrong to use".
For layout I recommend you going through different insteresting layouts people have designed for a "Single HTML" in CSS Zen Garden.
我不认为你应该努力使用 div,因为我个人不会,但也许这会有所帮助。
为什么不在 HTML 中使用表格进行布局?
I don't think you should struggle to use div's because I personally wouldn't but maybe this will help.
Why not use tables for layout in HTML?