相关疑难解决方法(0)

Google Chrome中大型(ish)html表的滚动行为很慢

我正在尝试使用滚动条创建一个大型HTML表(大约5000行),所以我考虑将该表插入一个<div>我可以随后格式化的表格.

它在Firefox 47和IE 11中运行良好,但在Chrome 59中滚动时表现不佳.

工作演示

<!DOCTYPE html>
<html>
    <head>
        <title>Test page</title>
    </head>

    <body>
        <div style="width: 400px; height: 300px; overflow: scroll;" id="test"></div>
        <script>
            let table = '<table style="table-layout: fixed; width: 3000px">';
            table += '<thead>';
            table += '<tr>';
            for(let i=0; i < 30; i++) { 
                table += '<th style="width: 100px">#' + i +'</th>';
            }
            table += '</tr>';
            table += '</thead>';
            table += '<tbody>';
            for(let i=0; i < 5000; i++) { 
                table += '<tr>';
                for(let j=0; j < 30; j++) …
Run Code Online (Sandbox Code Playgroud)

html google-chrome html-table

7
推荐指数
1
解决办法
1818
查看次数

标签 统计

google-chrome ×1

html ×1

html-table ×1