我需要一些关于在网页中移动设备底部放置页脚的帮助。目前,我在HTML页面底部有一个固定的页脚。但是,在移动设备上尝试聚焦输入框时,键盘会打开并将页脚隐藏在键盘下面。我该如何确保页脚始终位于键盘上方而不是下方?这是我目前拥有的CSS。
.footer {
position: fixed;
right: 0;
bottom: 0;
left: 0;
z-index: 999;
white-space: nowrap;
width: 100%;
color: black;
background-color: white;
border-top: 2px solid green;
padding-top: 6px;
padding-bottom: 6px;
padding-right: 5px;
height: 20px;
overflow-x: scroll;
overflow-y: hidden;
}
<!--Footer needs to be over the keyboard in mobile devices when the input gains focus-->
<input type="text" placeholder="Footer over Keyboard">
<div class="footer">
<button>Button 1</button>
<button>Button 2</button>
<button>Button 3</button>
</div>
注(编辑):如何防止移动键盘覆盖文本字段上方的页脚?不是我的问题。那个问题恰好与我的问题相反,没有提供任何答案或见解来解决我的问题。