TD column width value not working with fixed table-layout

后端 未结 7 1441
北恋
北恋 2021-01-17 18:52

I have following table structure:

col1 col
7条回答
  •  暖寄归人
    2021-01-17 19:20

    Instead of putting the width on the td, try adding it to the th using css.

    For example,

    HTML

    Heading 1 Heading 2 Heading 3
    TD 1 TD 2 TD 3

    CSS

    .column-1 {
        width: 50%;
    }
    .column-2 {
        width: 25%;
    }
    .column-3 {
        width: 25%;
    }
    

    I had the exact same problem and found this resource helpful:

    https://css-tricks.com/fixing-tables-long-strings/

提交回复
热议问题