HTML的footer置于页面最底部的方法

footer高度任意+js

fixed-bottom{position:fixed;bottom:0;100%;}

$(function(){

  $("#footer").removeClass("fixed-bottom");

  var contentHeight = document.body.scrollHeight,//网页正文的高度

    winHeight = window.innerHeight;//可视窗口高度

  if(!(contentHeight > winHeight)){

    $("#footer").addClass("fixed-bottom")

  } else{

    $("footer").removeClass("fixed-bottom")

  }

})

原文地址:https://www.cnblogs.com/wangpengfei8313/p/9066054.html