Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.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
Css 调整“的高度”;分区';s";根据集装箱_Css - Fatal编程技术网

Css 调整“的高度”;分区';s";根据集装箱

Css 调整“的高度”;分区';s";根据集装箱,css,Css,我如何才能使容器中的“div-3”调整为该容器所具有的高度 我需要适合的高“div-3”由div的1和2留下,无论这个div-3的内容不完整 可能是div 1或div 2未显示(显示:无) Html代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="htt

我如何才能使容器中的“div-3”调整为该容器所具有的高度

我需要适合的高“div-3”由div的1和2留下,无论这个div-3的内容不完整

可能是div 1或div 2未显示(显示:无)

Html代码:

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style>
.container{
    height:300px;
    overflow:hidden;
    width:500px;
}
.container div{
}
.div-1{
    background-color:#009966;
}
.div-2{
    background-color:#999999;
}
.div-3{
    background-color:#3399FF;
}

</style>
</head>
<body>
<div class="container">
    <div class="div-1">g f erg erg erg rga f erg erg erg rga</div>
    <div class="div-2">
        sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sf erg erg erg rgadf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />sdf<br />
    </div>
    <div class="div-3">b gf erg erg erg rga</div>
</div>
</body>
</html>

.集装箱{
高度:300px;
溢出:隐藏;
宽度:500px;
}
.货柜组{
}
.div-1{
背景色:#009966;
}
.div-2{
背景色:#999999;
}
.div-3{
背景色:#3399FF;
}
g f erg erg rga f erg erg rga
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
sdf
b绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色绿色
我不太清楚你在问什么。但是,如果在CSS中,不使用height,而是使用minheight,如果div内容小于指定的高度,它仍然会强制300px,如果大于300px,它会自动调整

e、 g

如果要确保显示所有div,可以尝试在div样式中设置属性

e、 g


你能把你的问题改一下吗?你的最后一句话是什么意思?IIRC,IE6不支持最小高度和最大高度。(IE6仍然有很多用户。)但我认为你可以使用这里的技巧来解决这个问题。
.container{
    min-height:300px;
    overflow:hidden;
    width:500px;
}
.div-3{
    background-color:#3399FF;
    max-height: 200px;
}