位置:粘贴对我来说似乎不适用于我将它应用于div的孩子.怎么解决?
HTML:
Lorem Ipsum
<div class="this-parent-div-is-necessary">
<div class="div-sticky-class">
Test
</div>
</div>
Lorem Ipsum
Run Code Online (Sandbox Code Playgroud)
CSS:
.div-sticky-class{
color: red;
position: sticky;
position: -webkit-sticky;
top: 0;
}
Run Code Online (Sandbox Code Playgroud)