colspan width issue

前端 未结 2 2048
名媛妹妹
名媛妹妹 2021-01-07 17:53

I\'m having trouble setting fixed widths on columns which use colspan.

It seems that neither IE8, Firefox or Chrome can figure out how to correctly size

2条回答
  •  误落风尘
    2021-01-07 18:23

    Because your column widths are contradicting. In row 1 you have columns widths 20, 50/2; in row 2 you have column widths 50/2, 20.

    Row 1, Column 1 is defined as 20.
    Row 1, Column 2 is defined as 50.
    Row 2, Column 1 is defined as 50.
    Row 2, Column 2 is defined as 20.
    

    You can't have overlapping colspans of different widths, the table cells need to line up. You're trying to draw this table:

    |-----|----------|
    |----------|-----|
    

    Which is not valid since the columns don't line up. In order to do this you need to add more columns:

    |-----|----.-----|
    |-----.----|-----|
    

    Where "." is a column that is hidden by the column span. Try this HTML:

    
    
    
        
            Test
        
        
            
    20 50
    50 20

提交回复
热议问题