css - <div> 高度 100% 在 Chrome 中不起作用

标签 css webkit

我有一个问题,已经在互联网上搜索过但无法解决。我有一个 iframe,里面有一个正在加载以下 CSS 的页面。

html, body {
position:relative;
height:100%;
} 

.c1{
    float:left;
    text-align:left;
    margin-top:1px;
    margin-bottom:1px;
    width:100%;
}

.c2{
    float:left;
    text-align:left;
    margin-top:1px;
    margin-bottom:1px;
    width:50%;
}

.cvalue{
    float:left;
    width:40%;
    padding-right:3px;
    text-align:right;
}

.titulo{
    DISPLAY: inline-block;
    padding-left:5%;
}

.abaA{
    display:inline-block;
    text-align:center;
    position:relative;
    margin-top:1px;
    width:100px;
    border:#000 solid 1px;
    border-bottom:0px;;
    background-color:#F9F9F9;
}

.abaA:hover {
    background-color: #F9F9F9;
    cursor: pointer;
}

.abaF{
    display:inline-block;
    text-align:center;
    position:relative;
    margin-top:1px;
    width:100px;
    border:#000 solid 1px;
    border-bottom:0px;
    background-color:#EEE;
}

.abaF:hover {
    background-color: #F9F9F9;
    cursor: pointer;
}

.areaA{
    float:left;
    position:relative;
    border:#000 solid 1px;
    border-top:0px;
    background-color:#F9F9F9;
}

.areaF {
    float:left;
    position:relative;
    border:#000 solid 1px;
    border-top:0px;
    display:none;
    background-color:#F9F9F9;
}

和下面的HTML代码

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <script language="JavaScript" type="text/javascript" src="/csp/broker/cspxmlhttp.js"></script>
    <script language="JavaScript" type="text/javascript" src="/csp/broker/cspbroker.js"></script>
     <script language="JavaScript" type="text/javascript" src="/csp/cratera/sys/function.js"></script><script language="JavaScript">cspHttpServerMethod("KJnjcEnDVCs$h8WvTvpH0LQbuqWLNC_moK_PLd1scC8cNx6fZxqGz_mS6Q0_HRLRO2oUxExyIGwafKPhULXcfw--")</script>
     <link rel="stylesheet" type="text/css" href="/csp/cratera/themes/default/css/style.css">
    <title>Cadastro de Empresa</title>
    <script language="JavaScript">

        function Salvar(){
            $CR.Submit("xiHqkWth9sV+2005/P0B5LY6k4AfsjV4hbGb3cevM8A",$("form"));
        }

        function Consultar(){
            $CR.Submit("tD3yLZP6yievtRoRMZLtjvnyw4Udr3eWUQNev/osmtg",$("form"));
        }

        function Novo(){
            $CR.ClearAll($("form"));;
            $CR.Submit("4evrj0yE4oGqBy1wKeKE+RJP0R4192anMoOcSNx5gJE",$("form"));
        }

    </script>

</head>

<body>
    <div class="titulo">Cadastro de Empresa</div><br><hr size="1" style="margin:0px">
    <div class="c1" style="text-align:right;">
            <input id="btnCad1" name="btnCad1" onClick="Salvar();" type="button" value="Cadastrar"></input> 
            <input id="btnNov1" name="btnNov1" onClick="Novo();" type="button" value="Novo"></input>    
            <input id="btnCon1" name="btnCon1" onClick="Consultar();" type="button" value="Consultar"></input>  
    </div>
    <br>    
    <span class="abaA" id="aba.endereco.cad" onClick="mudarAba(this);">Cadastro</span>
    <span class="abaF" id="aba.endereco.ent" onClick="mudarAba(this);">Entrega</span>
    <span class="abaF" id="aba.endereco.cob" onClick="mudarAba(this);">Cobrança</span>
    <br>
    <div class="areaA" id="area.endereco.cad" style="width:100%;height:90%;">
        <br>
            <form id="form">
            <!-- ALL FORM CODE HERE -->
            </form>
    </div>
    <div class="areaF" id="area.endereco.cob" style="width:100%;height:90%;">
        <br>
            Hello!
    </div>
    <div class="areaF" id="area.endereco.cob" style="width:100%;height:90%;">
        <br>
            Hello!
    </div>  
</body>
</html>

正如在设置选项卡中所见(class = "abaA"和 class = "abaF")我无法设置“高度:90%”。它适用于 Mozilla 和 Internet Explorer,但在 Chrome 和 Safari(对我的元素都很重要)中不起作用。我在网上查了一下,很多人都有这个问题,而且建议的解决方案都不适合我。

感谢任何帮助。 谢谢

最佳答案

之前有个div

<div class="areaA" id="area.endereco.cad" ...

有点像

<div>
    <br>    
    <span class="abaA" id="aba.endereco.cad" onClick="mudarAba(this);">Cadastro</span>
    <span class="abaF" id="aba.endereco.ent" onClick="mudarAba(this);">Entrega</span>
    <span class="abaF" id="aba.endereco.cob" onClick="mudarAba(this);">Cobrança</span>
    <br>
</div>
<div class="areaA" id="area.endereco.cad" style="width:100%;height:90%;">
    <br>
        <form id="form">
        <!-- ALL FORM CODE HERE -->
        </form>
</div>

会成功的。 顺便说一句,您应该检查您的代码,它远非有效。

关于css - <div> 高度 100% 在 Chrome 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3803663/

相关文章:

javascript - 我在 jQuery 事件处理和隐藏/显示图像元素方面做错了什么?

html - Opera <table> 换行错误

css - 将组件特定样式设置为 Material 组件中生成的 HTML

python - 根据传递的变量更改 HTML 表格中的颜色

google-chrome - Chrome 如何获取设备方向信息?

html - WebKit 浏览器中动态加载元素中的文本选择

html - CSS 设置默认滚动位置

html - webkit 盒子 vs boxflex

html - Chrome 中小型 &lt;input type ='button'> 上的 CSS Sprite

html - 摆脱-webkit-padding-start : 40px