Table with table-layout: fixed; and how to make one column wider

后端 未结 4 1692
甜味超标
甜味超标 2020-12-01 03:53

So I have a table with this style:

table-layout: fixed;

Which makes all columns to be of the same width. I would like to have one column (t

4条回答
  •  一生所求
    2020-12-01 04:33

    Are you creating a very large table (hundreds of rows and columns)? If so, table-layout: fixed; is a good idea, as the browser only needs to read the first row in order to compute and render the entire table, so it loads faster.

    But if not, I would suggest dumping table-layout: fixed; and changing your css as follows:

    table th, table td{
    border: 1px solid #000;
    width:20px;  //or something similar   
    }
    
    table td.wideRow, table th.wideRow{
    width: 300px;
    }
    

    http://jsfiddle.net/6p9K3/1/

提交回复
热议问题