[css] position:fixed; What should I do if it is invalid under ios?

[css] position:fixed; What should I do if it is invalid under ios?

把需要用手滑动的内容用clss为.content(名字随便起)的div包起来,样式代码如下:

.content {
position: fixed;
top: 0;
left: 0;
bottom: 180px; /距离底部的距离为底部盒子的高度,自己也可以设置/
overflow-y: scroll;
width: 100%;
height: auto;
-webkit-overflow-scrolling: touch; /这句是为了滑动更顺畅/
}
-webkit-overflow-scrolling: touch; /这句是为了滑动更顺畅/
这句代码一定得写,要不上下滑动起来有些卡顿,亲自体验过的。
然后把需要固定在底部的内容用class为.footer(名字随便起)的div包起来,样式代码如下:

.footer {
position: fixed;
bottom: 0;
height: 180px;
}
这样,在真机上再次测试就没有问题了。如有更好的解决办法,希望大家互相交流。

Personal profile

I am a song, welcome to share front-end and back-end knowledge with you. It is easy to give up,
but it must be cool to persist. Welcome everyone to discuss

Main directory

Clear the front-end interview questions with song

Guess you like

Origin blog.csdn.net/weixin_43392489/article/details/113813440