Setting a max height on a table

前端 未结 9 1376
猫巷女王i
猫巷女王i 2020-12-29 01:10

I am trying to design a page where there are some tables. It seems that styling tables is much more painful than it ought to be.

The problem is the following: The ta

9条回答
  •  执笔经年
    2020-12-29 01:58

    NOTE this answer is now incorrect. I may get back to it at a later time.

    As others have pointed out, you can't set the height of a table unless you set its display to block, but then you get a scrolling header. So what you're looking for is to set the height and display:block on the tbody alone:

    Header stays put, no scrolling
    cell 1/1 cell 1/2
    cell 2/1 cell 2/2
    cell 3/1 cell 3/2

    Here's the fiddle.

提交回复
热议问题