Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Div child在chrome或ie上未将高度设置为100%_Html_Css_Internet Explorer_Google Chrome - Fatal编程技术网

Html Div child在chrome或ie上未将高度设置为100%

Html Div child在chrome或ie上未将高度设置为100%,html,css,internet-explorer,google-chrome,Html,Css,Internet Explorer,Google Chrome,我有一个容器div,它还有两个子div,我希望类为“movablebartoggleswitch”的div的高度为其容器div的100%,这必须在IE8和chrome中工作,但它可以在一个或另一个中工作,但不能在两个中都工作,你能告诉我出了什么问题吗 <html> <head> <link href="styles.css" rel="stylesheet" type="text/css"> </head> <body> <div

我有一个容器div,它还有两个子div,我希望类为“movablebartoggleswitch”的div的高度为其容器div的100%,这必须在IE8和chrome中工作,但它可以在一个或另一个中工作,但不能在两个中都工作,你能告诉我出了什么问题吗

<html>
<head>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="configdiv" class="maindiv">
<div class="simpletext">    
</div>
<br/>
<div name="containertoggleswitch" class="containertoggleswitch">
<div class="movablebartoggleswitch">        
</div>
    <div class="bartoggleswitch">       
    </div>
</div>
</div>
</body>

</html>

.maindiv
{
background-color:#00ABA9;
color:#FFF;
position:absolute;
width:250px;
height:500px;
font-family: 'Segoe UI';
font-weight: lighter;
font-size:20;
overflow-y:scroll;
overflow-x:hidden;
/*Works for all browsers except IE*/
overflow: -moz-scrollbars-vertical;
}
.simpletext
{
width:100%;
}

.containertoggleswitch
{
width:100px;
height:30px;
background-color:#FFF;
position:relative;
}

.bartoggleswitch
{
position :relative;
color:#000; 
background-color:inherit;
height:100%;
width:100%;
border-style:solid;
border-width:5px;
border-color:#FFABAF;
}

.movablebartoggleswitch
{
clear:both;
position:absolute;  
z-index:10; 
width:20%;
height:100%;
background-color:#000;
float:left;
}


梅因迪夫先生 { 背景色:#00ABA9; 颜色:#FFF; 位置:绝对位置; 宽度:250px; 高度:500px; 字体系列:“SegoeUI”; 字体重量:较轻; 字号:20 ;; 溢出y:滚动; 溢出x:隐藏; /*适用于除IE以外的所有浏览器*/ 溢出:-moz滚动条垂直; } .simpletext { 宽度:100%; } .containertoggleswitch { 宽度:100px; 高度:30px; 背景色:#FFF; 位置:相对位置; } .Bartoggle开关 { 位置:相对位置; 颜色:#000; 背景色:继承; 身高:100%; 宽度:100%; 边框样式:实心; 边框宽度:5px; 边框颜色:#FFABAF; } .可移动BarToggle开关 { 明确:两者皆有; 位置:绝对位置; z指数:10; 宽度:20%; 身高:100%; 背景色:#000; 浮动:左; }
问题在于,
边框
样式导致元素展开,导致高度变化。要解决此问题,请使用
框大小:边框框
更改框模型,以使填充成为宽度的一部分


不知道这是否对你有帮助,但我在Chrome上也遇到了类似的身高问题(在其他地方效果很好)。我让它工作的方式是在DIV id的HTML代码中,我把
style=“min height:660px”
-或者你需要的任何高度。我的CSS中没有DIV id的
min height
height:auto
。我确实有
body,html{height:100%;height:auto;}

或者我应该说使元素展开吗