是否应该使用我的理解DIV而不是TABLE来布局数据

时间:2022-08-29 18:07:00

Is this correct and if so, where can I find a good resource to know how to do it, because, all the pages I've seen uses absolute position and things like that. Is this the correct way to go?

这是正确的吗?如果是这样,我在哪里可以找到一个很好的资源来知道如何去做,因为,我见过的所有页面都使用绝对位置和类似的东西。这是正确的方法吗?

EDIT

So my question is , how to put two elements side by side, how one on top of other etc. Is it using absolute position?

所以我的问题是,如何将两个元素并排放置,如何将其他元素放在其他元素之上等等。它是否使用绝对位置?

For instance this page uses very little table and layout everything in using DIV.

例如,此页面使用非常少的表格和布局使用DIV。

6 个解决方案

#1


2  

Is this correct

它是否正确

Not quite. You should use the elements that best describe the semantics of the data, then use CSS to lay them out.

不完全的。您应该使用最能描述数据语义的元素,然后使用CSS来布局它们。

where can I find a good resource to know how to do it

我在哪里可以找到一个知道如何做的好资源

See section 38 of the WSC: Headers, footers, columns, and templates. Possibly preceded by the earlier sections.

请参阅WSC的第38节:页眉,页脚,列和模板。可能在之前的部分之前。

#2


2  

You should use DIVs + CSS for layout and TABLE for tabular data.

您应该使用DIVs + CSS进行布局,使用TABLE进行表格数据。

Here is a good article about the subject

这是一篇关于这个主题的好文章

A list apart: Practical CSS

一个单独的列表:实用的CSS

This is a good page to start learning with practical examples CSS positioning

这是一个很好的页面,开始学习CSS定位的实际例子

#3


1  

Yes, DIVs have been used for some years now. You should also checkout the new layout tags in HTML5 such as <nav>, <section> etc..

是的,DIV已经使用了几年了。您还应该检查HTML5中的新布局标签,例如

Look at this blog post for some interesting comparison of DIV vs tables.

查看此博客文章,了解DIV与表的一些有趣比较。

#4


0  

I have recently adopted the Blueprint Grid CSS Framework, and really love it. It makes it easy to use divs to layout, without worrying about doing the positioning.

我最近采用了Blueprint Grid CSS框架,非常喜欢它。它可以很容易地使用div进行布局,而无需担心定位。

You should read the source. It's very simple, and does use some relative positioning under the hoods. Mostly, it just uses fixed widths to make the grid.

你应该阅读来源。它非常简单,并且确实在引擎盖下使用了一些相对定位。大多数情况下,它只使用固定宽度来制作网格。

There are many competing frameworks -- some support liquid layouts (non-fixed width).

有许多竞争框架 - 一些支持液体布局(非固定宽度)。

#5


0  

Yes, you should try. Use tables only for tabular content.

是的,你应该试试。仅将表用于表格内容。

For starters: From table hell to div hell?

对于初学者:从表地狱到地狱?

And no: using div's for layout doesn't require positioning, but that depends on the design.

而且:使用div进行布局不需要定位,但这取决于设计。

#6


0  

Tables should be used for representing tabular data, not for making layouts.

表应该用于表示表格数据,而不是用于制作布局。

This is a hot topic about this with excellent answers: Why not use tables for layout in HTML?

这是一个热门话题,有很好的答案:为什么不在HTML中使用表格进行布局?

Layouts without the use of tables aren't necessary to be created with absolute positioning. In tutorials 8 and 9 of this page liquid div layouts are being explained thoroughly, without the use of absolute positioning.

不使用表格的布局不必使用绝对定位创建。在本页的教程8和9中,液体div布局正在彻底解释,而不使用绝对定位。

#1


2  

Is this correct

它是否正确

Not quite. You should use the elements that best describe the semantics of the data, then use CSS to lay them out.

不完全的。您应该使用最能描述数据语义的元素,然后使用CSS来布局它们。

where can I find a good resource to know how to do it

我在哪里可以找到一个知道如何做的好资源

See section 38 of the WSC: Headers, footers, columns, and templates. Possibly preceded by the earlier sections.

请参阅WSC的第38节:页眉,页脚,列和模板。可能在之前的部分之前。

#2


2  

You should use DIVs + CSS for layout and TABLE for tabular data.

您应该使用DIVs + CSS进行布局,使用TABLE进行表格数据。

Here is a good article about the subject

这是一篇关于这个主题的好文章

A list apart: Practical CSS

一个单独的列表:实用的CSS

This is a good page to start learning with practical examples CSS positioning

这是一个很好的页面,开始学习CSS定位的实际例子

#3


1  

Yes, DIVs have been used for some years now. You should also checkout the new layout tags in HTML5 such as <nav>, <section> etc..

是的,DIV已经使用了几年了。您还应该检查HTML5中的新布局标签,例如

Look at this blog post for some interesting comparison of DIV vs tables.

查看此博客文章,了解DIV与表的一些有趣比较。

#4


0  

I have recently adopted the Blueprint Grid CSS Framework, and really love it. It makes it easy to use divs to layout, without worrying about doing the positioning.

我最近采用了Blueprint Grid CSS框架,非常喜欢它。它可以很容易地使用div进行布局,而无需担心定位。

You should read the source. It's very simple, and does use some relative positioning under the hoods. Mostly, it just uses fixed widths to make the grid.

你应该阅读来源。它非常简单,并且确实在引擎盖下使用了一些相对定位。大多数情况下,它只使用固定宽度来制作网格。

There are many competing frameworks -- some support liquid layouts (non-fixed width).

有许多竞争框架 - 一些支持液体布局(非固定宽度)。

#5


0  

Yes, you should try. Use tables only for tabular content.

是的,你应该试试。仅将表用于表格内容。

For starters: From table hell to div hell?

对于初学者:从表地狱到地狱?

And no: using div's for layout doesn't require positioning, but that depends on the design.

而且:使用div进行布局不需要定位,但这取决于设计。

#6


0  

Tables should be used for representing tabular data, not for making layouts.

表应该用于表示表格数据,而不是用于制作布局。

This is a hot topic about this with excellent answers: Why not use tables for layout in HTML?

这是一个热门话题,有很好的答案:为什么不在HTML中使用表格进行布局?

Layouts without the use of tables aren't necessary to be created with absolute positioning. In tutorials 8 and 9 of this page liquid div layouts are being explained thoroughly, without the use of absolute positioning.

不使用表格的布局不必使用绝对定位创建。在本页的教程8和9中,液体div布局正在彻底解释,而不使用绝对定位。