html - IE8剩余高度

标签 html css internet-explorer layout internet-explorer-8

我的目标是在 IE8 (&IE9) 中使用这样的结构。
不想使用 JavaScript,因为某些第 3 方正在动态插入内容,这只会导致不同的滚动条比例。

我一直在寻找“充足”的时间,即相当多的时间。 我未能理解和/或使用以下线程。 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=whole browser content),底部的 fiddler:

Chrome example

IE8/9 给我这个(pic=整个浏览器内容,再次滚动到正文底部):

IE messes up

Chrome's fine, fiddler.

谁能帮帮我?

最佳答案

厌倦了没有完成我想要的东西,我最终不得不使用 JS(我意识到确实没有人能够成功地回答我的问题,而且这个解决方案也不是我实际要求的)。

JSfiddle

fiddle 比下面显示的更复杂,因为我需要这些额外的东西。

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>

关于html - IE8剩余高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13528403/

相关文章:

javascript - javascript 数据库操作的对象方法中的异步回调

php - WordPress 发布缩略图问题

javascript - 从mysql输入的html中搜索数据

html - 如何制作带有居中 Logo 的导航栏

jquery - 如何仅将 CSS 应用于段落中的数字? (没有 <span>)

css - 删除开发期间在 chrome devtools 中创建的所有诊断样式

javascript - 一组 CSS 和 JS 文件在 HTML 中导入?

internet-explorer - Google DFP 刷新广告删除了 Internet Explorer 10 中的 window.history 堆栈

javascript - 获取 IE/Edge Javascript 中的输入滚动位置(包括 JSFiddle)

html - 样式表不能在 Chrome/Safari 中工作,但可以在 Internet Explorer 中工作