CSS如何防止键盘向上移动内容?

jstraugh43

我使用 Ionic v5 创建了一个简单的“注册”页面,并且对 CSS 和样式一般来说非常陌生。我无法找到一种方法来阻止键盘向上移动我的内容(见图)

键盘对比

我的 CSS

.bottom-grid {
    position: absolute;
    left: 0;
    right: 0;
    width: 85%;
    bottom: 10px;
}

.form-grid {
    position: absolute;
    left: 0;
    right: 0;
    width: 85%;
}

通过在这里搜索一些帖子,我尝试将位置更改为固定,并添加:

ion-grid {
    min-height: 100%;
}

没有太多的运气。如何将此底部网格保留在页面底部?感谢您的任何帮助!

卡兰

我的建议是使用 ion-footer。

<ion-header>
  <ion-back-button>
  Register
  ...
</ion-header>

<ion-content [fullscreen]=true class='myMaxHeightClass'>
  ...enter form inputs here
</ion-content>

<ion-footer>
 <p>Already have an account?</p>
 <ion-button>Login</ion-button>
</ion-footer>

在 Css 文件上(以防 fullscreen=true 不起作用):

.myMaxHeightClass {
    height: calc(100vh-150px)
 }

150px 是页脚的高度。

这应该使内容全屏显示,并且您的页脚将在底部保持粘性。

避免使用绝对定位的页脚按钮,因为根据我的经验会导致大混乱。

让我知道这是否适合您,如果不适合,我将尝试提出不同的方法

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章