3 ms·
It can be better to use divs instead of tables in some situations, especially when you want to display thousands of rows inside of a relatively complex DOM stru
by ceeessess 7y ago
It can be better to use divs instead of tables in some situations, especially when you want to display thousands of rows inside of a relatively complex DOM structure. All browsers seem to render them faster, but in Chrome specifically there are bugs like this: https://bugs.chromium.org/p/chromium/issues/detail?id=461877 https://bugs.chromium.org/p/chromium/issues/detail?id=461877 and one that can trigger a huge cascade of recursive style recalculations (which in practice freezes browsers for a few seconds). Virtual scrolling is another way of avoiding this problem but it can be tricky if you don't know the height of the rows.
- astura 7y agoThis table rendering bug still haunts me https://stackoverflow.com/questions/8474678/ie9-strange-table-issue https://stackoverflow.com/questions/8474678/ie9-strange-tabl...
- pault 7y agoLast year I had to build a UI with several thousand rows in a data grid. Of course I used a table for this, since tables are for displaying tabular data! Once I got a full set of production data into it, scrolling the page absolutely crushed the browser, running at about three frames per second. I believe the issue was actually caused by a parent element with overflow: scroll-y, but switching to divs made it run smooth as butter.