【问题标题】:Make a footer fill the remainder of the page with variable height content使用可变高度内容使页脚填充页面的其余部分
【发布时间】:2018-12-24 19:07:54
【问题描述】:

当正文是可变高度时,有人可以指出我正确的方向以使页脚填充页面的其余部分。我能找到的所有解决方案都假设标题和正文的高度是固定的。提前致谢!

【问题讨论】:

    标签: html css height footer


    【解决方案1】:

    通过JS获取页面内容和浏览器窗口的高度,设置页脚高度为heightofpage-heightofcontent。

    let pagecontentheight = document.getElementById('pagecontent').offsetHeight;
    let browserheight= window.innerHeight;
    
    let footer= document.getElementById('footer');
    footer.style.height = browserheight - pagecontentheight;
    

    这不会像那样工作,但它会让你明白我的意思。

    【讨论】:

      猜你喜欢
      • 2016-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多