Css positioning 2 divs in a div in the same line - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Css positioning 2 divs in a div in the same line

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">
#container {<!-- w  ww.ja  v a2 s.c  o  m-->
   background:Chartreuse;
   overflow:auto;
   padding:11px;
}

#left {
   background:yellow;
   float:left;
   width:201px;
}

#right {
   background:blue;
   margin-left:211px;
}
</style> 
 </head> 
 <body> 
  <div id="container"> 
   <div id="left">
     Lorem ipsum dolor s 
   </div> 
   <div id="right">
     Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendreri 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials