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

后端 未结 25 1613
有刺的猬
有刺的猬 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:11

    I took Earmon Nerbonne's answer and edited it to work with tables that fill the whole width.

    http://jsfiddle.net/DYgD6/6/

    
    testdoc
    
      
    1 QWERTYUIOPASDFGHJKLZXCVBNM QWERTYUIOPASDFGHJKLZXCVBNM
    2 QWERTYUIOPASDFGHJKLZXCVBNM QWERTYUIOPASDFGHJKLZXCVBNM
    3 QWERTYUIOPASDFGHJKLZXCVBNM QWERTYUIOPASDFGHJKLZXCVBNM
    4 QWERTYUIOPASDFGHJKLZXCVBNM QWERTYUIOPASDFGHJKLZXCVBNM
    5 QWERTYUIOPASDFGHJKLZXCVBNM QWERTYUIOPASDFGHJKLZXCVBNM
    6 QWERTYUIOPASDFGHJKLZXCVBNM QWERTYUIOPASDFGHJKLZXCVBNM
    7 QWERTYUIOPASDFGHJKLZXCVBNM QWERTYUIOPASDFGHJKLZXCVBNM
    8 QWERTYUIOPASDFGHJKLZXCVBNM QWERTYUIOPASDFGHJKLZXCVBNM
    9 QWERTYUIOPASDFGHJKLZXCVBNM QWERTYUIOPASDFGHJKLZXCVBNM

    The width of the fixed column still needs to be a set value though.

提交回复
热议问题