HTML Table, first and last column fixed width and columns between dynamic, but equal width

前端 未结 7 1358
长发绾君心
长发绾君心 2021-01-04 09:35

Is it possible to have a table with width 100% (so the table fits the screen size), where the first and the last column have a fixed width, and the columns between take the

相关标签:
7条回答
  • 2021-01-04 10:06

    What about using jQuery for this and calling javascript function once your table is created or some other event (like click) happens?

    See here (I created jsfiddle playground for this)

    What it does is that it checks the width of fixed elements (width of the whole table, first and last cell). Then it calculates and assigns the width for the rest of the cells which should have the remaining width divided between them (based on how many there are and how much space is left). Of course this is just quick example of possible solution. It needs polishing (checking null objects, if remaining width is greater than 0, ...)

    0 讨论(0)
提交回复
热议问题