如何将div设置为单元格的完整高度? [英] How do I set the div to be the full height of the cell?

查看:152
本文介绍了如何将div设置为单元格的完整高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个tablecell。

I have a inside a tablecell. I want the div to be the full height of the cell.

我把高度:100%的风格 - 但它不工作

I put height:100% in the style - but it does not work

<asp:TableCell ID="tdCustomerLogin" runat="server" HorizontalAlign="Center" VerticalAlign="Top" style="padding:2px; background-color:#33CC4D; border:solid 1px black;">
    <div style="background-color:White; border:solid 1px black; height:100%;">
     .......... other html code
    </div>
</asp:TableCell>


推荐答案

得到你想要的效果。

这是因为当每个表格单元格呈现时,其内容框不会伸展到与行的高度相匹配。

This is because when each table cell is rendered it's content box isn't stretched to match the height of the row. Instead it is given extra PADDING as required so that it's overall height matches the height of it's Row.

因此,实际上,Div的高度为100%,它的高度为

So in effect the Div does have a height of 100% -- it's just not what you expected.

http://www.w3.org/TR/CSS2/tables.html#height-layout

这篇关于如何将div设置为单元格的完整高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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