Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Min-Height for a table in firefox not working

Tags:

html

css

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 like FireFox, tried the display:block; but that makes things worse on chrome.

Thanks.

.table-wrap {
    min-height: 323px;
}

table {
    width: 100%;
    min-height: 323px;
}

table tr {
    min-height: 54px;
}
like image 957
mdixon18 Avatar asked Oct 22 '13 14:10

mdixon18


People also ask

How do you control the height of a table?

To set the row height to a specific measurement, click a cell in the row that you want to resize. On the Layout tab, in the Cell Size group, click in the Table Row Height box, and then specify the height you want. To use the ruler, select a cell in the table, and then drag the markers on the ruler.

How do you set a fixed table height in HTML?

The height of rows 'tr' in a table can be fixed very easily. This can be done by adding the height attribute in the tr tag. If the height is not specified, the height of the row changes according to the content. The height can be specified either in pixels, or percentage.

How do you fix the height of a row?

Set a row to a specific height Select the row or rows that you want to change. On the Home tab, in the Cells group, click Format. Under Cell Size, click Row Height. In the Row height box, type the value that you want, and then click OK.

What is min height in HTML?

The min-height CSS property sets the minimum height of an element. It prevents the used value of the height property from becoming smaller than the value specified for min-height .


4 Answers

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

like image 164
LorDex Avatar answered Oct 03 '22 13:10

LorDex


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

like image 36
Marina Noelia Cabane Avatar answered Oct 01 '22 13:10

Marina Noelia Cabane


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/

like image 9
Marc Audet Avatar answered Oct 03 '22 13:10

Marc Audet


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

like image 3
Morgan Feeney Avatar answered Oct 01 '22 13:10

Morgan Feeney