div的高度就像剩余的高度一样

时间:2010-06-08 13:14:10

标签: css xhtml html

我有两个div

 <div id="uno">
    text      
 </div>
 <div id="due">
    text
 </div>

div#uno{
  width:300px; 
  height: 100px;
  border: 1px solid blue;
  overflow:hidden;
}

div#due{
   width:300px; 
   height: 200px; 
   border: 1px solid yellow;
    overflow:scroll;
}

如何让div id =“due”的高度等于页面的剩余高度?

1 个答案:

答案 0 :(得分:3)

确保您指定了HTML 4.01或XHTML 1.x或更高版本的doctype:

div#uno{
 position:absolute;
 width:300px;
 height:100px;
 top:0px;
 border:1px solid blue;
 overflow:hidden;
}

div#due{
 position:absolute;
 width:300px;
 top:100px;
 bottom:0px;
 border:1px solid yellow;
 overflow:scroll;
}