【问题标题】:footer overlapping content in IE7? :(IE7中的页脚重叠内容? :(
【发布时间】:2010-12-05 05:24:45
【问题描述】:

感谢参与 stackoverflow 的优秀人员see here,我认为我已经完成了这个布局。不幸的是,虽然我在 IE7 中发现了一个问题(尚未在 IE6 中检查!) - 页脚与内容重叠

我已经把网站up on my development server here。我希望我不必从头开始就可以让它工作,并且 CSS 会来拯救...

【问题讨论】:

    标签: css internet-explorer-7 cross-browser


    【解决方案1】:

    将页脚推到视口底部的一种快速简便的方法是使用以下 JavaScript。诀窍是有一个单独的容器和一个页脚,并在脚本中引用这些 id:

    在头部标签中:

    还有脚本:

    try {
        document.execCommand("BackgroundImageCache", false, true);
    }
    catch (err) {
    
    }
    
    function getWindowHeight() {
        var windowHeight = 0;
        if (typeof (window.innerHeight) == 'number') {
            windowHeight = window.innerHeight;
        }
        else {
            if (document.documentElement && document.documentElement.clientHeight) {
                windowHeight = document.documentElement.clientHeight;
            }
            else {
                if (document.body && document.body.clientHeight) {
                    windowHeight = document.body.clientHeight;
                }
            }
        }
        return windowHeight;
    }
    function setFooter() {
        if (document.getElementById) {
            var windowHeight = getWindowHeight();
            if (windowHeight > 0) {
                var contentHeight = document.getElementById('container').offsetHeight;
                var footerElement = document.getElementById('footerContainer');
                var footerHeight = footerElement.offsetHeight;
                if (windowHeight - (contentHeight + footerHeight) >= 0) {
                    footerElement.style.position = 'relative';
                    footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
                }
                else {
                    footerElement.style.position = 'static';
                }
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-19
      • 1970-01-01
      • 2017-06-16
      • 1970-01-01
      • 2017-07-06
      相关资源
      最近更新 更多