How to make table row fixed at the top

前端 未结 5 594
梦谈多话
梦谈多话 2020-12-17 16:24

I have a table without th elements, Only td elements are there. Is there any way to make My first row fixed(label). The table is like this

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-17 16:35

    On the row that you want to stay fixed, set the style position: fixed and set a background color to that row, or you will end up having two layers of text when you scroll the list.

    Another issue to pay attention to is the fact that the first row will be hidden under the fixed row, due to how the fixed position style works. to fix this put in a blank row.

    Name Age
       
    John 28
    Jacob 22
    Nicole 12

    See link for my full code. http://jsfiddle.net/brettadamsga/yeAhU/

提交回复
热议问题