【发布时间】:2026-01-12 02:05:01
【问题描述】:
在具有溢出:隐藏的容器内时,位置粘性不起作用。但是需要隐藏溢出!
<div class="lg:col-start-7 lg:col-end-13" style="overflow:hidden">
<div style="min-height:100%;">
<div class="bg-placeholder-bg w-full" style="position:relative">
<img src="image:src" style="position: sticky;top: 10px;">
</div>
</div>
</div>
编辑:好的,我刚刚意识到这一切都被包装在一个容器中,该容器具有并且需要溢出:隐藏,因此它为什么不起作用!有什么想法吗?
【问题讨论】:
-
请发布一个工作示例,阅读minimal reproducible example
-
给具有 col 类的父容器一个固定的高度,看看会发生什么。 min:height 是一个相对高度,问题是它与什么相关?父高度和父高度也是自动的。
-
我能找到的唯一解决方案是删除溢出:隐藏!
标签: html css image overflow sticky