我可以使用表格,tr或td的最小高度吗? [英] Can I use a min-height for table, tr or td?

查看:2205
本文介绍了我可以使用表格,tr或td的最小高度吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在表格中显示接收的一些细节。

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

我希望该表格有最小高度来显示产品。所以如果只有一种产品,那么表格最后至少会有一些空白。另一方面,如果有5个或更多的产品,它不会是空的空间。

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.

我试着用这个CSS:

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

但它不起作用。

预先感谢。

推荐答案

这不是一个很好的解决方案,但可以像这样尝试:

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>

并将div设置为最小高度:

and set the divs to the min-height:

div {
    min-height: 300px;
}

希望这是你想要的...

Hope this is what you want ...

这篇关于我可以使用表格,tr或td的最小高度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆