首页 > 解决方案 > 位置修复底部不适用于 iOS Safari

问题描述

非常不幸的是position: fixed; bottom: 0;唯一在 iOS Safari 上。

有一些在线解决方案说使用transform: translate3d(0,0,0);也不适用于此错误。

iOS版本是11.4

演示:https ://codepen.io/athimannil/pen/BqBezY

body {
  height: 1500px;
  background-repeat: no-repeat;
  background-image: linear-gradient(red, yellow, green);
  color: white;
  position: relative;
}

.link {
  display: block;
  text-align: center;
  background-color: deepskyblue;
  width: 100%;
  height: 50px;
  line-height: 50px;
  text-decoration: none;
  color: white;
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  transform: translate3d(0, 0, 0);
}
<a class="link" href="#">Hello</a>

标签: htmlcsscss-position

解决方案


推荐阅读