未设置div高度时如何让html表格的高度=父div的高度 [英] How to have html table's height = height of parent div when div's height is not set

查看:44
本文介绍了未设置div高度时如何让html表格的高度=父div的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在div内有一个html表.div的高度基于div中的其他元素.

I have an html table, inside of a div. The div's height is based on other elements in the div.

如何使表格的高度等于其父div的高度?

How can I have the table's height be equal to its parent div's height?

(表格高度:由于未设置div的高度,所以100%无法使用)

(table height: 100% won't work because the div's height is not set)

更新:我需要支持IE6、7、8,因此这些浏览器应该可以理解css的建议.

Update: I need to support IE6,7,8 so the css recommendations should be understood by these browsers.

推荐答案

尝试使用 position:relative min-height:100%;

Mb甚至 posinion:absolute top:xxx bottom:xxx right:xxx left:xxx -定位和 height:auto .

Mb even posinion:absolute, top:xxx, bottom:xxx, right:xxx and left:xxx - positing and height:auto.

这篇关于未设置div高度时如何让html表格的高度=父div的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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