CSS Tutorial

Fixed Positioning

<!DOCTYPE html>
<title>Example</title>
<style>
  .absolute {
    position: absolute;
    top: 500px;
    left: 60px;
    height: 2000px;
    background-color: limegreen;
  }
  .fixed {
    position: fixed;
    top: 10px;
    left: 10px;
    background-color: gold;
    width: 90px;
    padding: 20px;
  }
</style>
<div class="absolute">
This tall div is absolutely positioned 500 pixels from the top and 60 pixels from the left of its containing block.
</div>
<div class="fixed">
  This div is using a fixed position of 100 pixels from the top and 60 pixels from the left of its containing block. When this page scrolls, this box will remain in a fixed position - it won't scroll with the rest of the page. Go on - SCROLL!