position an element aside to other using id/class - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

position an element aside to other using id/class

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">
#class1 {<!-- ww w  .ja v a 2 s  . co  m-->
   width:201px;
   height:201px;
   background:Chartreuse;
}

#class2 {
   position:absolute;
   top:11px;
   left:221px;
   width:201px;
   height:201px;
   background:red;
}
</style> 
 </head> 
 <body> 
  <div id="class1">
    Lorem 
  </div> 
  <div id="class2">
    Lorem 
  </div>  
 </body>
</html>

Related Tutorials