Tables overflowing with CSS in Firefox

前端 未结 2 1103
醉酒成梦
醉酒成梦 2021-01-14 01:55

I\'m having trouble getting my table to behave. The content keeps overflowing and my attempts to restrict it are not producing the desired effect.

This is my markup:

2条回答
  •  难免孤独
    2021-01-14 02:37

    Tables are notoriously difficult to style. Try adding this to your CSS:

    table { table-layout: fixed; width: 100% /* or whatever fixed width */; }
    

    I'd also suggest using actual HTML COL / COLGROUP elements to define your columns, as so:

    Col 1 Col 2 Col 3

    Do take note that, despite this, cells with overflowing data will force the containing cell, row, and table to expand to fit. CSS overflow: auto / hidden / scroll do not affect cells.

    Ref:

    • CSS: Table Layout,
    • HTML: COLGROUP

提交回复
热议问题