【问题标题】:Two horizontal divs' fluid height in a div一个div中两个水平div的流体高度
【发布时间】:2012-05-02 03:05:02
【问题描述】:

我不是网页设计师..我只是一个 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 样式。

你们能帮帮我吗?

谢谢你!!!!!!

【问题讨论】:

  • 如果切换到严格的文档类型会怎样?能解决问题吗?
  • 为了实验,这里是来源:jsfiddle.net/developdaly/hjkZm
  • @F. Calderan :( 好吧,也许这会起作用,但 XHTML 1.0 是我唯一可以使用的 DOC 类型

标签: css html nested height


【解决方案1】:

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

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

【讨论】:

  • 嗯...但我确实需要将这些东西的大小固定在相同的高度。
猜你喜欢
  • 1970-01-01
  • 2014-05-22
  • 1970-01-01
  • 2010-09-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-03
  • 2014-08-09
相关资源
最近更新 更多