其他分享
首页 > 其他分享> > android – 如何防止移动键盘在文本字段上升?

android – 如何防止移动键盘在文本字段上升?

作者:互联网

我的页脚有问题.我希望页脚停留在屏幕的底部,但是有一个小问题.使用移动浏览器时,打开键盘时某些字段会被页脚阻止.页脚从键盘上升并阻挡您正在键入的字段.如何将页脚保持在底部并防止其从键盘上升?我希望它隐藏在键盘下面.

我正在使用bootstrap,但我在自己的CSS中设置了以下内容:

footer {
 width: 100%;
 position:absolute;
 left:0px;
 bottom:0px;
 height: 40px;
 margin: auto;
 overflow: hidden;
 background:#2E2E2E;
 text-align:center;
 line-height: 15px;
 color: #fff;

}

<html>
 <body>
  <div class="container">
  </div>
  <footer class="bs-footer" role="contentinfo">
 </body>
</html>

正如你在这里看到的那样.当我激活“Salasana”字段时,页脚会上升并阻止文本字段.

在打开键盘之前:

打开键盘后:

解决方法:

用avinash帮助解决了这个问题.我最终在我的CSS中更改了以下内容.由于我拥有容器div内的所有内容,因此我将容器高度设为100% – 页脚.我也删除了底部:从页脚0px.

footer{
 position: relative;
}
html,body {
    height: 100%; /* Needed for container's min-height  */  
}

.container{
    min-height:100%;
    margin-bottom: -40px; /* Put negative height of the footer here */
    padding-bottom: 40px; /* Put height of the footer here. Needed for higher than screen height pages */
}

标签:html,android,css,twitter-bootstrap,mobile-browser
来源: https://codeday.me/bug/20191004/1853730.html