底部绝对位置上的脚将不起作用[关闭]

问题描述 投票:-3回答:2

我正在设计一种具有一些预定义样式的网页。我希望底部对齐页脚,以便在您加载到网站时看起来很正常。当我尝试使用“ bottom:0; position:absolute”来执行此操作时,它可以在台式机上运行,​​但是当您切换到手机或笔记本电脑时,它将覆盖其他内容并显示在其顶部。我要附上图片:MobileLaptop以及它的外观; Laptop

任何帮助将不胜感激。

javascript html css footer bottomnavigationview
2个回答
1
投票

仅当车身高度小于窗口高度时才使用位置bottom:0。>>

if ($(document.body).height() < $(window).height()) {
    $('#footer').attr('style', ' position: absolute; bottom: 0;left: 0; right: 0;');
}

-1
投票

元素在它上面是position: relative

© www.soinside.com 2019 - 2024. All rights reserved.