当我使用位置粘性ios Safari在手机上时溢出内容错误
我想在截面内使用两个块的位置粘性块(第一个)。第一个粘块是图像,其次是任何具有白色背景的内容。
html:css:
<section>
<div class="first">
<img src="https://images.unsplash.com/photo-1604311795833-25e1d5c128c6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=654&q=80" alt="asd">
</div>
<div class="second">Lorem ipsum dolor sit amet consectetur adipisicing elit. Ex voluptatum sit tempore libero, temporibus ea maxime consequatur pariatur incidunt iste.</div>
</section>
css:
section {
position: relative;
display: flex;
flex-direction: column;
}
.first {
position: sticky;
top: 0;
}
img {
max-width: 100%;
display: block;
}
.second {
font-size: 62px;
z-index: 1;
background: white;
}
它可以正常工作,但是对于Safari中的iOS设备,我们可以看到我们可以看到的一部分。图像。我们还可以在Safari移动模拟器中检测到它。 screenshot-bug
如果我添加属性溢出:hissed for parent for for parent for for parent for parent section section searve naterve butsion nocation却无法正常工作:sticky无法正常工作。
我们可以为这个问题提供另一个解决方案吗? 先感谢您! 问候
I want to use position sticky block(first) inside the section with two blocks. First sticky block is image and second is any content with white background.
HTML:
<section>
<div class="first">
<img src="https://images.unsplash.com/photo-1604311795833-25e1d5c128c6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=654&q=80" alt="asd">
</div>
<div class="second">Lorem ipsum dolor sit amet consectetur adipisicing elit. Ex voluptatum sit tempore libero, temporibus ea maxime consequatur pariatur incidunt iste.</div>
</section>
CSS:
section {
position: relative;
display: flex;
flex-direction: column;
}
.first {
position: sticky;
top: 0;
}
img {
max-width: 100%;
display: block;
}
.second {
font-size: 62px;
z-index: 1;
background: white;
}
It works properly but for iOS devices in Safari we can see part of image. We also can detect it in a Safari mobile emulator.
screenshot-bug
If I add property overflow: hidden for parent section it will solve issue but position: sticky will not work.
Can we have another solution for this issue?
Thank you in advance!
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论