ตำแหน่ง :เหนียว; คุณสมบัติช่วยให้คุณวางตำแหน่งองค์ประกอบตามตำแหน่งการเลื่อน ตั้งค่าองค์ประกอบให้ติดหนึบเมื่อผู้ใช้เลื่อนลง
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้ตำแหน่ง CSS:sticky;
<!DOCTYPE html>
<html>
<head>
<style>
div.sticky {
position: -webkit-sticky;
position: sticky;
top: 0;
padding: 10px;
background-color: orange;
border: 1px solid blue;
}
</style>
</head>
<body>
<p>Scroll and see the effect!</p>
<div class = "sticky">Sticky!</div>
<div style = "padding-bottom:2000px">
<p>This is demo text.</p>
<p>Scroll down to view the sticky div.</p>
</div>
</body>
</html>