一个 div 中两个水平 div 的流体高度



我不是网页设计师。我只是一个 asp.net 程序员,我很难使用IE7。好吧,我设法在IE8,IE9和Chrome中工作。现在我必须让它在IE7中工作。

首先这是我的来源

我正在使用 DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"

和 HTML xmlns="http://www.w3.org/1999/xhtml" lang="ko"

xml:lang="ko"

<style type="text/css">
    html {
    height: 100%
}
body {
    background-color: #5c87b2;
    font-size: .85em;
    font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif;
    margin: 0;
    padding: 0;
    color: #696969;
    border: 0;
    overflow: visible;
    height: 100%; 
    max-height: 100%;
}
</style>

<div id="header" style="
                        display:block;
                        position:fixed;
                        height:50px; width:100%;
                        background-color:red;">
                        d
</div>
<div id="menu" style="
                        display:block;
                        position:fixed;
                        width:200px;
                        top:50px; left:0; right:auto; bottom:0;
                        background-color:blue;">
                        d
</div>
<div id="button" style="
                        display:block;
                        position:fixed;
                        width:auto; height:100px;
                        top:50px; left:200px; right:0; bottom:auto;
                        background-color:Yellow;">
                        d
</div>
<div id="content" style="
                        display:block;
                        position:fixed;
                        width:auto; height:auto;
                        top:150px; left:200px; right:0; bottom:0;
                        background-color:green;">
    <div style="
                position:relative;
                height:50%;
                min-height:50%;
                border:3px solid pink;
                ">12412
    </div>
    <div style="
                position:relative;
                height:50%;
                border:3px solid white;
                ">
                2214124
    </div>
</div>

所以我有一个标题(红色),左侧菜单(蓝色),子标题(黄色),容器(绿色)我需要容器中的两个div(粉红色,白色边框)。他们需要 100% 垂直填充容器。所有外部div 的位置都是固定的。我给了内部两个div的位置相对,并给了两个50%的高度。它在IE8,9,Chrome中工作正常。

我不会使用脚本。只尝试使用 css 样式。

那么你们能给我一些帮助吗?

谢谢你!!!!

在外部 #contentdiv 上设置高度允许内部div 像在其他浏览器中一样显示。当您正在寻找全屏面板设置时,我不确定如何使用像素值来实现这一点。从 px 更改为 % 并将位置和宽度/高度指定为流体似乎在 IE7 中达到了预期的效果。

http://jsfiddle.net/VCztH/3/

最新更新