一。css方法

<style type="text/css">
html,body{
height: 100%;
}
body{
display: flex;
flex-direction: column;
height: 100%;
}
.head{
flex: 0 0 auto;
}
.content{
flex: 1 0 auto;
}
footer{
background: #333;
flex: 0 0 auto;
}
</style>

二。js方法

<script type="text/javascript">
// 判断窗口高度,使footer始终在底部
$(document).ready(function(){
if($(document.body).height()<$(window).height()){
$(".footer").css({"position":"fixed","bottom":"0px"});
}
})
</script>

相关文章:

  • 2021-09-21
  • 2022-12-23
  • 2021-05-02
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2021-11-02
  • 2021-06-03
猜你喜欢
  • 2021-06-20
  • 2022-03-02
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-09-28
相关资源
相似解决方案