How do I create an HTML table with a fixed/frozen left column and a scrollable body?

后端 未结 25 2307
有刺的猬
有刺的猬 2020-11-21 22:27

I need a simple solution. I know it\'s similar to some other questions, like:

  • HTML table with fixed headers and a fixed column?
  • How can I lock the fir
25条回答
  •  天命终不由人
    2020-11-21 23:09

    Opera was buggy for all of the previous answers when I tested them on my mac. If you scroll through the table the fixed column disappears after you pass the first unfixed column. I went ahead and wrote the code below. It works in all the browsers I have locally installed. I don't know how ie handles it though.

    Just keep that in mind that if you intend to skip rows in one table and not the other or change the heights of the rows you might need to adjust this code.

    row 1
    row 2
    col 1 col 2 col 3 col 4
    col 1 col 2 col 3 col 4

提交回复
热议问题