Basic CSS positioning stack - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Basic CSS positioning stack

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.box {<!--from w  w w  . j ava 2s. co m-->
   width:401px;
   height:201px;
   position:relative;
}

#up {
   background:red;
}

#middle {
   margin-top:-51px;
   background:green;
}

#down {
   background:blue;
}
</style> 
 </head> 
 <body> 
  <div class="box" id="up"></div> 
  <div class="box" id="middle"></div> 
  <div class="box" id="down"></div>  
 </body>
</html>

Related Tutorials