[英]safe-area-inset-bottom not working on ios 15 safari
I'm trying to get my website to fit inside my phone screen.我试图让我的网站适合我的手机屏幕。 I have tried many variations of env(safe-area-inset-bottom) and constant(safe-area-inset-bottom) but both always return 0px (I've been using an app called Inspect to debug CSS on my iPhone 13).
我尝试了许多 env(safe-area-inset-bottom) 和 constant(safe-area-inset-bottom) 的变体,但都总是返回 0px(我一直在使用名为Inspect的应用程序在我的 iPhone 13 上调试 CSS) .
Here's a link to the github repo .这是 github repo 的链接。 All code that relates to this issue should be in
/src/app.tsx
.与此问题相关的所有代码都应位于
/src/app.tsx
中。 Here is a link to the live site if you want to see the problem yourself.如果您想自己查看问题,这里是指向实时站点的链接。
UPDATE: I've been doing some testing and have found that in portrait mode, safe-area-inset-* is ALWAYS 0px, but in landscape mode it works as expected.更新:我一直在做一些测试,发现在纵向模式下,safe-area-inset-* 始终为 0px,但在横向模式下它可以按预期工作。 Does this mean that safe-area-inset-* isn't the correct solution for ios 15 safari?
这是否意味着 safe-area-inset-* 不是 ios 15 safari 的正确解决方案? Clearly the url bar obscures the 'safe area' in portrait mode...
显然,url 条在纵向模式下掩盖了“安全区域”......
I've made sure to add <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
to my head tag but this has no effect.我已确保将
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
添加到我的 head 标签中,但这没有效果。 Could someone please explain how I can ensure that my site doesn't go past the bottom URL bar on ios 15 Safari? Could someone please explain how I can ensure that my site doesn't go past the bottom URL bar on ios 15 Safari? I've attached screenshots from my phone showing the problem:
我附上了我手机上的截图,显示了这个问题:
I think I made it work using -webkit-fill-available
the other day which respects safe area.我想我前几天使用
-webkit-fill-available
让它工作了,它尊重安全区域。
body {
min-height: -webkit-fill-available;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.