移动网站中的表格与 div

发布于 2024-08-29 01:08:05 字数 83 浏览 3 评论 0原文

我对这个问题完全感到困惑,有些人说使用表格,另一些人说使用表格是一种不好的做法,而应该使用 div 标签。为移动设备开发网站.mobi时的正确方法是什么

I'm totally confused on this matter, some say use tables and others say it's a bad practice to make use of tables and div tags should rather be used. What is the correct way when developing sites for mobile devices .mobi

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

白鸥掠海 2024-09-05 01:08:05

您应该使用表格来呈现表格数据,而不是用于布局。移动电话上的大多数现代 Web 浏览器(例如 iPhone 上的 Mobile Safari)都能够正确呈现适当使用 CSS 和语义标记的网站。

You should use tables for presenting tabular data, not for layout. Most modern Web browsers on mobile phones (e.g. Mobile Safari on the iPhone) are quite capable of properly rendering websites that use CSS and semantic markup appropriately.

筱果果 2024-09-05 01:08:05

是的,理论表明您应该使用表格来呈现表格数据,而不是用于布局。但市场上的大多数 Web 浏览器都无法正确渲染带有浮动 div、高级 CSS 等的复杂布局。

事情正在迅速变化,正如其他人已经说过的,移动(智能)手机(iPhone、Android)上的大多数现代 Web 浏览器...) 具有出色的 HTML/CSS/Javascript 支持。
如果您只考虑这些设备,则可以使用 DIV/CSS 布局,因为从语义的角度来看这是正确的选择。但如果您想覆盖广泛的设备,请使用表格,因为您将保证您的页面能够在更多设备中正确呈现。

Yes, theory says that you should use tables for presenting tabular data, not for layout. But most of web browsers in the market do not properly render complex layouts with floating divs, advanced CSS, etc.

Things are changing quickly, and as other people have already said, most modern Web browsers on mobile (smart)phones (iPhone, Android...) come with a great HTML/CSS/Javascript support.
If you only have these devices in mind, you can go with DIV/CSS layouts, as it is the right choice from a semantic point of view. But if you want to cover a wide range of devices, use tables as you'll guarantee your pages are going to render properly in more devices.

梦幻之岛 2024-09-05 01:08:05

要考虑的重要方面是数据和数据之间的差异。它在屏幕上的实际布局。

通常,表格数据应使用表格来呈现。例如,将公司资产负债表视为可以使用 HTML 表格显示的表格数据的示例。

但是,如果您需要在行和行中显示正常内容(本质上不是表格),列,还有其他替代方案,例如使用 DIV & SPAN 标签和一些用于定位和定位的 CSS设置内容样式,使其看起来像表格布局。这种布局的典型示例可能是报纸上显示的新闻文章。虽然布局是按行和栏目中,新闻内容本身是非表格的。

有大量文章争论为什么这是一个好的做法。

鉴于您的情况,我建议坚持使用基于 DIV 的正常结构和基于 CSS 的样式,以达到所需的效果和效果。使用 TABLE 来存储表格数据。

HTH。

The important aspect to consider is the difference between data & its actual layout on the screen.

Typically, tabular data should be presented using tables. For example, consider a company balance sheet as an example of tabular data which can be shown using HTML tables.

But, if you need to show normal content (which is not tabular in nature) in rows & columns, there are other alternatives like using DIV & SPAN tags and a bit of CSS to position & style the content to make it look like a tabular layout. A typical example of such a layout could be a news article shown on a newspaper. While the layout is in rows & columns, the news content itself is non-tabular.

There are tons of articles out there which debate why this is a good practice.

Given your case, I would recommend stick to normal DIV-based structure with CSS-based styling to give the desired effect & use TABLEs for tabular data.

HTH.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文