Min-Height for a table in firefox not working

后端 未结 4 1157
春和景丽
春和景丽 2021-01-07 22:48

Basically, i would like to have a min-height for my table, so that responsively it can adjust at it\'s own means. This works beautifully in chrome but it really doesn\'t lik

相关标签:
4条回答
  • 2021-01-07 23:30

    Unfortunately specifically with Firefox this is a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=307866

    min-height: [whatever]
    

    will not play well with

    display: table
    

    The only alternative is to use a fixed height.

    Case closed

    0 讨论(0)
  • 2021-01-07 23:31

    The effect of min-height property is not defined for tables, table rows and table cells.

    See: http://www.w3.org/TR/CSS21/visudet.html#min-max-heights

    Suppose your markup looks like the following HTML:

    <div class="table-wrap">
        <table>
            <tr>
                <td>Cell 1 Donec ipsum libero...</td>
            </tr>
            <tr>
                <td>Cell 2</td>
            </tr>
        </table>
    </div>
    

    Now, consider the following CSS:

    .table-wrap {
        min-height: 323px;
        border: 1px dotted blue;
    }
    table {
        width: 400px;
        height: 323px;
        border: 1px dashed red;
    }
    table tr {
        height: 54px;
    }
    table td {
        border: 1px dotted red;
    }
    

    In this case, the table will have a minimum height of 323px, and this height will be distributed among the various rows in the table depending on the details of the content in each row's table cells.

    At the very least, each row will be at least 54px in height.

    If you have many rows with short cells (less than 54px in height), then eventually the table height will adjust to accommodate the rows.

    If the table has only a few rows with short cells, then the rows will increase in height to fill up the table's height of 323px.

    The .table-wrap parent element does not have any effect on the height of the table in this case.

    See fiddle at: http://jsfiddle.net/audetwebdesign/zMtBu/

    0 讨论(0)
  • 2021-01-07 23:36

    change table's min-height to height. if the content is higher, table will be enlarged anyway

    0 讨论(0)
  • 2021-01-07 23:50

    Add height: 0 and that will make Firefox take the min-height

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