gpt4 book ai didi

css - 高度 100% 不适用于 Internet Explorer 8 中的 DIV 标签

转载 作者:技术小花猫 更新时间:2023-10-29 11:10:57 25 4
gpt4 key购买 nike

我有以下代码,用于显示带有滚动结果部分的搜索工具。在 IE 中,代码工作正常:

   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html style="background:black;height:100%;width:100%;">
<head>
<title>Report</title>
</head>
<body style="background:black;">
<table HEIGHT="100%" WIDTH="100%" style="background:red;">
<tr>
<td>
Search Area
</td>
</tr>
<tr>
<td HEIGHT="100%" WIDTH="100%" style="background:orange;">
<div style="overflow-y:scroll;height:100%;">
<table style="width:100px;height:1000px;">
<tr>
<td style="background:white;">
Results Area
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>

但是当我通过添加以下内容将元标记设置为使用 IE8 格式时:

<meta http-equiv='X-UA-Compatible' content='IE=edge' />

底部的 DIV 标签扩展到页面之外。我已经尝试了很多选项,但是如果不实际指定值的高度就无法找到解决方法。这将不起作用,因为无论浏览器窗口的大小如何,我都希望页面占据 100% 的屏幕。

如有任何帮助,我们将不胜感激。

最佳答案

此元标记支持正确的 CSS 呈现,并且在 CSS 中 – 设计 – height:100% basically doesn't work .

您需要为元素的每个 单个祖先指定特定的高度,包括<body> , <table> , <tr>甚至<tbody>由解析器自动插入的元素。

无论如何,这个布局可以用更简单的方式实现:

.topBanner {
position:absolute; position:fixed;
height:2em;
top:0; left:0; width:100%;
}
body {padding-top: 2em}

这在 IE6 中会很好地降级,不像 overflow , 将在 Mobile Safari 中正常工作。

关于css - 高度 100% 不适用于 Internet Explorer 8 中的 DIV 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1533298/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com