<!DOCTYPE html> <style> html, body {margin: 0; padding:5px} </style> <div style="position: relative; height: 100px; width: 100px;"> <div style="background: blue; position: absolute; top: 10px; width: 40px; height: 50px;"> </div> </div> <div style="position: relative; height: 100px; width: 100px;"> <div style="background: blue; position: fixed; left: 20px; width: 40px; height: 50px;"> </div> </div> <div style="overflow: auto; position: relative; height: 100px; width: 100px;"> <div style="background: blue; position: relative; width: 200px; height: 200px;"> </div> </div> <div style="overflow: auto; position: relative; height: 100px; width: 100px;"> <div style="background: blue; position: absolute; width: 200px; height: 200px;"> </div> </div>