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

查看:23
本文介绍了大型 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.

我目前在尝试从下拉列表中选择一个值以及显示隐藏的表格行时遇到了长时间的延迟.

I am currently experiencing lengthy delays when attempting to select a value from the drop down, and when displaying the hidden table rows.

表格是我这里问题的根源吗?

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):

  • 在表格上将表格布局 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天全站免登陆