为什么使用DIV或跨度标签“更好”比使用表格布局?
可能重复:
为什么不在HTML中使用表格布局?
为什么使用标记定义一切(容器,标题,内容等)divs比使用表?我明白,当你使用表格构建你的页面:看起来丑陋的地狱,看起来甚至UGLIER时,嵌套,因为更高的垃圾量 - 稍微更高的页面加载时间,更少的可读代码。
Why is using markup with divs defining everything (container, header, content, etc) BETTER than using tables? I understand that when you build your page using tables it: look ugly as hell, look even UGLIER when nested, because of the higher volume of bullshit - slightly higher page load time, and less readable code.
但是。使用表格非常简单,并且在尝试完成看起来很简单的事情时节省了大量的时间,但要注意使其在所有浏览器之间工作。
BUT. Using tables is so easy and saves SO much time in trying to accomplish what would seem to be an easy thing, but with the caveat of making it work across all browsers.
我要求的是,不会有一个复杂的布局(或任何布局,通常不会很容易完成与只有divs和css)最好解决与混合的表和CSS与一些div包装所需的元素(处理嵌套的),所以你可以快速开发您的应用程序,不担心它看起来像crap不支持的浏览器?
What I'm asking is, wouldn't a somewhat complex layout (or any layout that wouldn't normally be easy to accomplish with just divs and css) be best solved with a mix of tables and css with some divs wrapping needed elements (to deal with the nestedness) so you can rapidly develop your application and NOT worry about it looking like crap on unsupported browsers ?
*!编辑! * 我也完全同意,表格是表格数据,只是在语义我觉得我应该使用无用的标签,然后命名他们和造型他们,但对于我,我发誓这么多次快速只是快速构建一个东西,使用表BEATS试图完美地样式来工作在所有浏览器。
* !EDIT! * I also agree completely that yes, tables are for tabular data, and just on semantics I feel I should be using do-nothing tags, then naming them and styling them, but for ME, I swear so many times to quickly just build something fast, using tables BEATS trying to style it perfectly to work on ALL browsers.
它主要是关于语义, 我认为。 < table>
用于表示表格数据,并使用它来布置元素违反了这一点。此外,使用< table> 可以轻松或轻松地完成任何操作。这不是那么容易在其他情况下,像你说,这使得标记丑陋,很难跟随。它还违反了内容,行为和对web开发的基本表达的分离。
It's mostly about the semantics, I think. A <table>
is built to represent tabular data, and using it to lay out elements violates that. Also, anything that can be done with <table>
can be done just as easily or easier with CSS 99.9% of the time. It's not that much easier in the other cases, and like you say, it makes markup ugly and hard to follow. It also violates the separation of content, behaviour, and presentation fundamental to web development.