使用表格或div

发布于 2024-10-11 22:38:08 字数 88 浏览 4 评论 0原文

构建网页 div 或表格时的最佳实践是什么?

有人说推荐使用div,但我发现用div控制大小和对齐方式并不容易。

你的意见是什么?

What is the best practice when building our web page div or table?

Someone says the div is recommended, but I found it is not easy to control the size and alignment with div.

What is your opinion?

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

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

发布评论

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

评论(5

帅气尐潴 2024-10-18 22:38:08

这完全取决于您想要显示的内容

  • 用于页面布局
  • < ;Table> 用于显示表格数据(例如数据点等)

使用进行整个页面布局的日子已经一去不复返了 - 你由于这个原因,应该不鼓励使用它们。

HTML 标记应为 语义。这意味着描述它包含的数据 - 而不是如何显示它(这是由样式表处理的)

It depends entirely on what you're wanting to display:

  • <DIV> and <SPAN> is for page layout
  • <Table> is for displaying tabular data (such as data points etc)

The days of using <table> for whole page layouts is gone - and you should be discouraged for using them for this reason.

HTML tags are meant to be semantic. This means describing the data it contains - not how to display it (this is for stylesheets to handle)

时光暖心i 2024-10-18 22:38:08

TABLE 从根本上来说并没有什么问题——只是历史上它被过度地用于错误的事情。一般来说,尝试将 TABLE 用于真正的数据表,将 DIV 和 SPAN 用于逻辑块或内联内容容器。

There's nothing fundamentally wrong with TABLE - it's just that it was historically overused for the wrong thing. In general, try to use TABLE for true tables of data, use DIV and SPAN for logical block or inline containers of content.

逐鹿 2024-10-18 22:38:08

表格只能用于以表格方式显示数据。对于布局和设计,最佳实践是使用 div 和样式表。

如果您不习惯的话,使用样式表控制 div 可能会花费一些时间,但它很容易上手。

当客户希望重新设计整个网站时,您会庆幸您后来这样做了,这意味着您不必撤消整个页面即可进行所需的更改。

Tables should only be used to display data in a tabular way. For layout and design it is best practise to use divs and stylesheets.

Controlling the divs using stylesheets can take a while if you're not used to it, but it's quite easy to pick up.

You'll be thankful you did it later when the client wants the whole site redesigned and it means you don't have to undo the entire page in order to make the required changes.

千紇 2024-10-18 22:38:08

首先阅读:http://www.smashingmagazine.com/2009/04/08/from-table-hell-to-div-hell/" rel="nofollow"> slimingmagazine.com/2009/04/08/from-table-hell-to-div-hell/

在我看来(我确信有些人会抱怨 Stack Overflow 上提出的主观问题),但是我更喜欢使用 div's。 div 标签是一个标签,表格需要许多标签来创建正确标记的表格元素。

20 世纪 90 年代的许多网站都是使用表格构建的,但现在的想法是使用 div

First read this: http://www.smashingmagazine.com/2009/04/08/from-table-hell-to-div-hell/

In my opinion (which I'm sure some people will groan about subjective questions being asked on Stack Overflow), but I prefer using div's. A div tag is one tag, a table takes many tags to create a correctly marked-up table element.

A lot of websites in the 1990s were built with tables, but the thinking nowadays in to use divs.

迷鸟归林 2024-10-18 22:38:08

我想说 div 绝对是网站布局的行业标准。一开始使用它们可能会很麻烦,但是一旦你了解了它们的位置,你就再也不会看桌子了。

尝试本教程从表格移动到 div。 http://www.devarticles。 com/c/a/Web-Style-Sheets/DIV-Based-Layout-with-CSS/

I would say that div is definitely the industry standard for website layouts. They can be quite cumbersome to work with at first but once you get your head around how they are positioned then you will never look at tables again.

Try this tutorial for moving from tables to divs. http://www.devarticles.com/c/a/Web-Style-Sheets/DIV-Based-Layout-with-CSS/

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