Horizontal scroll on overflow of table

后端 未结 6 1817
耶瑟儿~
耶瑟儿~ 2021-01-30 12:31

I have a basic table in a container. The table will have about 25 columns. I am trying to add a horizontal scroll bar on overflow of the table and am having a really tough time.

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-30 13:10

    A solution that nobody mentioned is use white-space: nowrap for the table and add overflow-x to the wrapper.

    (http://jsfiddle.net/xc7jLuyx/11/)

    CSS

    .wrapper { overflow-x: auto; }
    .wrapper table { white-space: nowrap }
    

    HTML

    This is an ideal scenario if you don't want rows with multiple lines.
    To add break lines you need to use
    .

提交回复
热议问题