Chrome doesn't honor row height if rowspan is present

后端 未结 3 857
情书的邮戳
情书的邮戳 2020-12-17 07:13

I want to make a table with a cell that spans on two rows. The second row must have the height size as minimum as possible. Example:

html:



        
相关标签:
3条回答
  • 2020-12-17 07:25

    Answer from Lucas Malor almost works.

    It happens that IE doesn't respect table height=100% :( For me solution was easy, I just set height in pixels, because I know height of first column.

    0 讨论(0)
  • 2020-12-17 07:33

    Found: the trick is to put another table inside a cell of the table with the non-rowspan content, remove the rowspan from the other cell and set the outer and inner table height to 100%. Horrible but effective.

    HTML:

    <table id="outer"><tbody><tr>
        <td>
            <table id="inner"><tbody>
                <tr id="row-1">
                    <td>1st row</td>
                </tr>
                <tr id="row-2">
                    <td>2nd row</td>
                </tr>
            </tbody></table>
        </td>
        <td>
            a<br />
            a<br />
            a<br />
            a<br />
            a<br />
            a<br />
            a<br />
            a<br />
            a<br />
        </td>
    </tr></tbody></table>
    

    CSS:

    #row-2 
    {
        height: 1px;
    }
    #outer, #inner 
    {
        height:100%;
    }
    

    http://jsfiddle.net/xp7vz/3/

    0 讨论(0)
  • 2020-12-17 07:38

    try position:fixed

    it sort of works. http://jsfiddle.net/43CEX/

    i think in general you want to use divs for this kind of work, since tables natively grow by their own

    update

    this http://jsfiddle.net/h4Ycj/

    or this http://jsfiddle.net/m7eqm/

    0 讨论(0)
提交回复
热议问题