kilkadg kilkadg - 6 months ago 16
HTML Question

Can I use a min-height for table, tr or td?

I am trying to show some details of a receive in a table.

I want that table to have a min height to show the products. So if there is only one product, the table would have at least some white space at the end. In the other hand if there are 5 or more products, it won't be that empty space.

I have try with this css:

table,td,tr{
min-height:300px;
}


But it is not working.

Thanks in advance.

Answer

It's not a nice solution but try it like this:

<table>
    <tr>
        <td>
            <div>Lorem</div>
        </td>
    </tr>
    <tr>
        <td>
            <div>Ipsum</div>
        </td>
    </tr>
</table>

and set the divs to the min-height:

div {
    min-height: 300px;
}

Hope this is what you want ...