How to scroll table's “tbody” independent of “thead”?

前端 未结 5 415
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 01:15

As specified in the W3 specification for Tables:

Table rows may be grouped into a table head, table foot, and one or more table body sections, using

5条回答
  •  没有蜡笔的小新
    2020-12-01 01:55

    thead {
      position: fixed;
      height: 10px; /* This is whatever height you want */
    }
      tbody {
      position: fixed;
      margin-top: 10px; /* This has to match the height of thead */
      height: 300px; /* This is whatever height you want */
    }
    

提交回复
热议问题