【发布时间】:2019-03-13 14:33:41
【问题描述】:
我需要有关在网页中放置移动设备的页脚方面的帮助。目前,我在 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>
注意(编辑):How to prevent mobile keyboard from rising footer over the text fields? 不是我的问题。这个问题与我的问题完全相反,没有提供答案或洞察如何解决我的问题。
【问题讨论】:
-
@DannyBuonocore 如果我错了,请纠正我,但这与我问的完全相反,不是吗?
标签: javascript html css footer