首先添加带有 viewport-fit=cover
的<meta name="viewport" />
标签:
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
/>
然后需要适配的元素添加如下CSS:
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
如:
.fixed-bottom {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
网友评论