实际表。 Div表 [英] Actual table Vs. Div table
问题描述
这
<table>
<tr>
<td>Hello</td>
<td>World</td>
</tr>
</table>
可以这样做:
<div>
<div style="display: table-row;">
<div style="display: table-cell;">Hello</div>
<div style="display: table-cell;">World</div>
</div>
</div>
现在,这两者之间在性能和渲染速度方面有什么区别,
Now, is there any difference between these two in terms of performance and/or render speed or they're just the same?
推荐答案
使用div模拟数据表在语义上是不正确的,一般与性能无关,因为渲染是即时的。瓶颈来自JavaScript或极长的页面,有很多嵌套的元素,通常在过去是100嵌套表创建布局。
It is semantically incorrect to simulate data tables with divs and in general irrelevant to performance as rendering is instant. The bottle neck comes from JavaScript or extremely long pages with a lot of nested elements which usually in the old days is 100 nested tables for creating layouts.
使用表为他们是为了和div是为他们的意思。显示表行和单元格属性是利用div布局,然后创建用于数据表示的表。看看他们是一个与报纸或杂志中相同的布局列和行。
Use tables for what they are meant to and div's for what they are meant to. The display table-row and cell properties are to utilize div layouts more then creating tables for data representations. Look at them as a layout columns and rows same as those you can find in a newspaper or a magazine.
性能明显你有几个字节与div示例, lol:)
Performance wise you have couple of more bytes with the div example, lol :)
这篇关于实际表。 Div表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!