< div>元素而不是< table&gt ;? [英] <div> element instead of <table>?

查看:121
本文介绍了< div>元素而不是< table&gt ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重复:

  • Why not use tables for layout in HTML?
  • DIV’s vs Tables or CSS vs. Being Stupid

Theres最近谈论了很多关于使用div而不是表格标签来使你的页面更加灵活的浏览器。为什么是div更好?

Theres been a lot of talk lately about rather using div than table tags to make your pages more browser fiendly. Why is div better?

推荐答案

有几个原因:

1 )div在语义上更正确在大多数情况下。在表结构中对其网站进行编码的人员不会使用表格来创建它们,这是表格数据。 divs代表一个部门或页面的一部分,所以把项目放在divs是更正确的。

1) div is more semantically correct in most cases. people who code their sites in table structure aren't using tables for what they're made for, which is tabular data. divs represent a "division" or a section of the page, so putting items in divs is more correct.

2)divs更灵活,更容易的风格和维护。您不必每次都写< table>< tr>< td>文字这里< / td>< / tr>< / table> 你可以在< div>文本这里< / div> 上写出一些东西。你可以添加css钩子(即,类或元素)到表和div,但是与divs是无限更灵活。

2) divs are more flexible and easier to style and maintain. you don't have to write <table><tr><td>Text here</td></tr></table> every time you want to say something when you can just write <div>Text here</div> instead. you can add css hooks (ie, classes or elements) to both tables and divs, but with divs it is infinitely more flexible.

3)表结构化网站只是简单丑陋:)

3) table structured sites are just plain ugly :)

这篇关于&lt; div&gt;元素而不是&lt; table&gt ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆