IE8剩余高度

问题描述:

我在IE8(& IE9)中寻找这样的结构。
不想使用JavaScript,因为某些第三方会动态插入内容,这应该只会导致不同的滚动条比例。IE8剩余高度

我一直在寻找“充足”的时间,即相当多的时间。 我无法理解和/或使用以下线程。 StackOverflow: make-iframe-to-fit-100-of-containers-remaining-height

<!DOCTYPE html> 
<html> 
    <body> 
     <p>Some text with unknown height, fixed at the top.</p> 
     <div> 
      Some content that will not exceed the body (100% height), 
      but will fill the body until the content is too long, which would give 
      a scrollbar. 
     </div> 
    </body> 
</html> 

我能够在Chrome浏览器(PIC =整个浏览器的内容)来实现这一点,小提琴手在底部:

Chrome example

IE8/9给了我这个(PIC =整个浏览器内容,再滚动到身体的底部):

IE messes up

Chrome's fine, fiddler.

谁能帮助我?

+2

除非因为我回答的东西已经改变了[这个问题](http://stackoverflow.com/questions/10294543/overflow-with-absolute-relative-positioning-layout/10297421#10297421),我不没想到在IE8中可能没有一点JavaScript。 – thirtydot

+0

这可能涉及如果页面调整大小,可能会导致白色区域包装,使调整大小处理程序..:/ – EricG

+0

我不是建议作为您的问题的答案。我的意思是,我记得试图回答这个问题,尝试在阳光下做的一切事情,在IE8中做出与你正试图解决的问题相同的事情。 – thirtydot

由于劳累不完成我想要的东西,我被迫毕竟用JS(我知道没有人能够成功地回答了我的问题的确,这种解决方案的心不是任何什么,我居然问)。

JSfiddle

的小提琴比什么如下所示更为复杂,因为我需要这个额外的东西。

function adjustHeight() { 

    var header = document.getElementById("header"); 
    var container = document.getElementById("container"); 

    container.style.top = header.clientHeight + "px"; 
} 

// Note the place of the method invocation ('asap'), adjustHeight() 
<body> 
    <div id="header"> 
     <p id="p"> 
      Line1<br/> 
      Line2<br/> 
      Line3<br/> 
      Line4<br/> 
     </p> 
     <div id="toggle">Toggle</div> 
    </div> 
    <div id="container"> 
     <script>adjustHeight();</script> 
     <div id="content"> 
      First row visible<br/><br/> 
      Scrollbar shows normally<br/> 
      Body doesnt scroll<br/> 
      Works on resize too (by default)<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/> 
      One row..<br/><br/> 

      Last row visible on collapsed/expanded 
     </div> 
    </div> 
</body> 

我看到你在这里使用div而不是iframe,这里是一个应该工作的小提琴。使用定位元素的 。

position:absolute; 
bottom:0px; 
top:80px; 
left:0px; 
right:0px; 

http://jsfiddle.net/XQbzy/1/

+0

不错的尝试,但白色的“标题”部分必须是可变的高度:http://jsfiddle.net/thirtydot/XQbzy/2/ – thirtydot

+0

是的,否则你会使顶部标题滚动也... –