大的HTML表格很慢吗? [英] Are large html tables slow?

查看:81
本文介绍了大的HTML表格很慢吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近正在开发一个使用大量(数百)行的表的应用程序。这些行包含表格数据,每行包含两个下拉列表以及显示其下方直接隐藏的表格行的链接。

I've recently been developing an application using tables with a large number (hundreds) of rows. The rows contain tabular data and each row contains two drop down lists as well as link which displays hidden table rows directly below it.

我尝试

表格是我问题的根源吗?

Is the table the source of my problem here?

推荐答案

从我收集的内容来看,如果宽度没有明确说明,HTML表格可能会显得很慢。如果不是,浏览器必须先完成单元格内容的加载,然后才能计算出正确的宽度。
MSDN有一些信息这里关于他们的构建高性能HTML页面文章可能有所帮助;他们建议如下(特别是关于表):

From what I gather, HTML tables can be appear to be slow to render if widths are not explicitly stated. If they aren't, the browser has to finish loading the contents of the cells before it can calculate the correct widths.

MSDN has some information here on their "Building High Performance HTML Pages" article that may help; they suggest the following (regarding tables specifically):



  • 将table-layout CSS属性设置为 fixed

  • 为每列明确定义 col 对象。 >
  • 设置每个 col 的WIDTH属性。

  • Set the table-layout CSS attribute to fixed on the table.
  • Explicitly define col objects for each column.
  • Set the WIDTH attribute on each col.

这篇关于大的HTML表格很慢吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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