当前位置:网站首页>UNI-APP_iphone苹果手机底部安全区域
UNI-APP_iphone苹果手机底部安全区域
2022-08-11 03:01:00 【小歪 | 前端】
项目要在底部(tabbar之上)做一个固定的按钮,在一般手机下,样式没问题。在iPhone xr和iphone11下,就出现位置不正确,问题是iphone多了一个安全区域问题
大概是这一块。也是算在整个page高度里的,如果不加这个高度,那么固定定位的位置就会比原先的低(所以说,项目还是要真机测试才准确,模拟器测不准)。
解决:https://ask.dcloud.net.cn/article/36494
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
解释个说明:var(–safe-area-inset-bottom) 安全区域的高度,直接带单位(px),只有有安全区域的手机这个值才有,其他的都是0
ps:var(–safe-area-inset-bottom) 这个属性只有在里才行,js和html的style貌似都不行**(有简单的试过,具体怎么写才能使用在js和html的style里,这个就不得而知了,有大佬知道的话,请留言,谢谢!)**
要在底部固定定位的话
.bottom{
bottom: env(safe-area-inset-bottom);
}
/*如果要在tabbar之上的话,就在加tabbar的高度,例如tabbar的高度为120rpx*/
.bottom{
bottom: calc(120rpx + env(safe-area-inset-bottom));
}
边栏推荐
猜你喜欢
MSP430如何给板子下载程序?(IAR MSPFET CCS)
Add user error useradd: cannot open /etc/passwd
AI+Medical: Using Neural Networks for Medical Image Recognition and Analysis
正式发布丨VS Code 1.70
Salesforce解散中国团队,什么样的CRM产品更适合中国人
关于地图GIS开发事项的一次实践整理(上)
Briefly, talk about the use of @Transactional in the project
flink The object probably contains or references non serializable fields.
解决vim与外界的复制粘贴(不用安装插件)
多线程之ThreadPoolExecutor
随机推荐
Idea (优选)cherry-pick操作
[机缘参悟-66]:怎样才能让别人愿意帮你:利益共享法则、“大道”、“人性”
Goodbye Chengdu paper invoices!The issuance of electronic invoices for accommodation expenses will soon completely replace the invoices of hotels, catering and gas stations
The problem that Merge will be lost again after code Revert has been solved
Traversal of DOM tree-----modify styles, select elements, create and delete nodes
思念家乡的月亮
深度学习中的模型设计
“京台高铁”亮相百度地图,真能在2035年建成吗?
Add user error useradd: cannot open /etc/passwd
SIT221 Data Structures and Algorithms课程辅导
JS-DOM元素对象
ifconfig与ip命令的比较
①In-depth analysis of CAS SSO single sign-on framework source code
解决vim与外界的复制粘贴(不用安装插件)
聊聊对RPC的理解
The negative semantic transformation layer
Deep Learning - Second Time
Window function application of sum and count
Typescript study notes | Byte Youth Training Notes
Detailed explanation of new features of ES advanced function syntax