Any way to synchronize table column widths with HTML + CSS?

前端 未结 9 1315
花落未央
花落未央 2020-12-24 05:05

I have a number of tables with the same columns and it would look a lot nicer if they shared the same column widths. Is such a thing possible? Putting them in the same tab

9条回答
  •  春和景丽
    2020-12-24 05:38

    It's only possible if you can fix-width the columns. If you can set a fixed width then some css like this should work:

    td {
        width: 25%;
    }
    

    You can customize each columns width like this:

    ... ...
    ...
    ... ...

    and then specify the widths like this:

    .col1 {
       width: 25%;
    }
    .col2 {
       width: 75%;
    }
    

提交回复
热议问题