Fixed position but relative to container - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Relative Position

Description

Fixed position but relative to container

Demo Code

ResultView the demo in separate window

<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>

Related Tutorials