100% height on nested table cell in IE [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this questionI want a nested table to expand to the height of the enclosing cell. This works as expected in Firefox/Chrome/Safari, but not in IE7 or IE8. Please see the example here:
http://www.bitmechanic.com/heightDemo.html
The DOCTYPE is relevant. While the demo above validates as HTML 4.01 Strict, it does not render properly in IE7. If I remove the DOCTYPE entirely, or set it to HTML 3.2, it renders properly in IE.
Any suggestions on how to get this to render in 4.01 (strict or loose)? The actual web site is a bit more complicated -- changing the DOCTYPE will cause all sorts of other problems.
We're struggling to und开发者_JS百科erstand the (presumed) IE bug here and how to work around it.
Not much you can do it's IE that is still misbehaving also in version 7 and 8. Read this answer: Table layout wrong in IE(7)
You have only two solutions:
either you remove the DOCTYPE for that page with the risk to get into many other displaying issues,
or you have to use Javascript to get the height of the table and you enforce the cells height in px to the same height of the table.
精彩评论