Make 2 tables have the same column sizes

前端 未结 4 2517
陌清茗
陌清茗 2021-02-19 18:29

I have 2 HTML tables that are directly on top of each other. Each table has the same number of columns, but the text they contain can differ. And each table can contain many r

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-19 19:07

    Table cells are fluid by nature, so that is not possible in just html / css unless you give the columns a fixed width (fixed can of course also be a percentage).

    You could of course use javascript to find the widest table, get its column widths and use those values for the smaller table, but the solution suggested by belugabob as a comment to your question is far better.

提交回复
热议问题