Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sticky positioning in CSS3
#1
Description:

Sticky positioning allows elements to stick to a specific position relative to the viewport when scrolling. It's useful for creating sticky navigation bars or sidebars.

Example:

<!DOCTYPE html>
<html>
<head>
  <title>Sticky Positioning Example</title>
  <style>
    .sticky-element {
      position: sticky;
      top: 20px;
      background-color: lightblue;
      padding: 10px;
    }
  </style>
</head>
<body>
  <div class="sticky-element">This element sticks to the top when scrolling.</div>
  <div style="height: 1000px;"></div>
</body>
</html>
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)