[英]Overflow-x: hidden position disables position: sticky of my container
我的網站在移動設備上出現水平滾動問題,谷歌搜索了一下,找到了解決方案:
max-width: 100%;
overflow-x: hidden;
}
問題是,我有一個元素在滾動時應該是粘性的。
HTML:
<div class="row">
<div class="col-md-6 align-self-start sticky-sidebar">
<h2 class="text-light landing-heading d-inline">What we do</h2>
<img
src="./images/image.png"
alt="image"
/>
<p>This is sticky!</p>
</div>
CSS:
position: -webkit-sticky;
position: sticky;
top: 12%;
}
How can I have this element sticky, and horizontal scroll on mobile hidden? What am I doing wrong and having horizontal scroll on iPhone in the first place? thanks
發現問題了!
我的元素之一有糟糕的填充。 修復了填充,水平滾動消失了。 我刪除了'overflow-x',因為現在我不需要一切都像魅力一樣工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.