很遗憾,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>