当我将<div class="sticky">Title</div>
打包到另一个<div></div>
时,它再也无法工作了。为什么?我怎样才能让它发挥作用?
<!DOCTYPE html>
<html>
<head>
<style>
.sticky {
top: 0;
position: sticky;
position: -webkit-sticky;
}
p {
line-height: 150px;
}
</style>
</head>
<body>
<div class="sticky">Title</div>
<p>text</p>
<p>text</p>
<p>text</p>
<p>text</p>
<p>text</p>
<p>text</p>
<p>text</p>
</body>
</html>