将文本保留在移动页面的底部

Keep text in bottom of page in mobile

根据这个问题:How to put text in the upper right, or lower right corner of a "box" using css,我创建了这个代码:

#copyright {
  position: absolute;
  bottom: 0;
  right: 2;
  width: 100px;
  text-align: center;
}

#creator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100px;
  text-align: center;
}

在电脑上它工作正常。但是,当我通过 Google 的 Chrome 手机模拟器对其进行测试时,文本不会在滚动后到达底部,就像粘性页脚那样。我创建了一个JSFiddle,但似乎无法重现该行为,所以我截图了:

有什么想法吗?

您想使用 position: fixed,而不是 absolute

您可以将 position: relative 添加到 body 元素。

body {
  position: relative;
}

在这样做时,#copyright/#creator 元素将相对于 body 元素绝对 相对 定位,这就是您在这种情况下想要。