当前位置:网站首页>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));
}
边栏推荐
- Idea (优选)cherry-pick操作
- (CVPR-2017)在身体和潜在部位学习深度上下文感知特征以进行行人重识别
- leetcode: 358. Reorder strings at K distance intervals
- Vim and copy and paste from the outside (don't need to install the plugin)
- What does the sanction of the mixer Tornado mean for the DeFi market?
- DOM树的遍历-----修改样式,选择元素,创建和删除节点
- flink The object probably contains or references non serializable fields.
- 数据存储全方案----详解持久化技术
- Salesforce disbands the Chinese team, which CRM product is more suitable for the Chinese
- 2022年广东省安全员A证第三批(主要负责人)操作证考试题模拟考试平台操作
猜你喜欢
ROS源代码阅读(1)
Detailed explanation of new features of ES advanced array function syntax
OpenCV founder: Open source must not be completely free!
google搜索技巧——程序员推荐
A Practical Arrangement of Map GIS Development Matters (Part 1)
Summary of debugging skills
"How to kick a bad habit to read notes?
基于FPGA状态机的自动售货机功能实现
Salesforce解散中国团队,什么样的CRM产品更适合中国人
Detailed explanation of new features of ES advanced function syntax
随机推荐
Typescript学习笔记 | 字节青训营笔记
Window function application of sum and count
Goodbye Guangzhou paper invoices!The issuance of electronic invoices for accommodation fees will completely replace the invoices of hotels, restaurants and gas stations
最倒霉与最幸运
Ninjutsu_v3_08_2020 - safety penetrating system installation
21 Day Learning Challenge Week 1 Summary
《如何戒掉坏习惯》读书笔记
Briefly, talk about the use of @Transactional in the project
ifconfig与ip命令的比较
Detailed explanation of new features of ES advanced function syntax
21天学习挑战赛第一周总结
this question in js
A practice arrangement about map GIS (below) GIS practice of Redis
DOM-DOM tree, a DOM tree has three types of nodes
CSAPP Data Lab
成都纸质发票再见!开住宿费电子发票即将全面取代酒店餐饮加油站发票
comp3331-9331-22t1-midterm复习辅导-tutorial week 5
7 sorting algorithms that are often tested in interviews
The negative semantic transformation layer
维特智能惯导配置