HTML CSS examples for CSS Layout:Relative Position
Fixed position but relative to container
<html> <head></head> <body style="width: 1000px !important;margin-left: auto;margin-right: auto"> <div style="width: 100px; height: 100px; background-color: #ccc; position:fixed;"> </div> <!-- w w w.j ava 2 s.c o m--> <div id="1" style="width: 100%; height: 600px; background-color: #800000"> </div> <div id="2" style="width: 100%; height: 600px; background-color: #100000"> </div> <div id="3" style="width: 100%; height: 600px; background-color: #400000"> </div> </body> </html>