Positioning div right to a already centered content without absolute position - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Absolute Position

Description

Positioning div right to a already centered content without absolute position

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">
#Wrapper1 {<!--from www.  jav  a2 s.  co m-->
   width:801px;
   background-color:Chartreuse;
   margin:0 auto;
   white-space:nowrap;
   padding:11px;
}

#rightElement1 {
   background-color:yellow;
   position:fixed;
   width:100px;
   display:inline-block;
}

#leftElement1 {
   background-color:blue;
   width:701px;
   display:inline-block;
}

#repositionning {
   background-color:pink;
   margin-left:51px
}

#leftElement2 {
   margin:0 auto;
   width:701px;
   background-color:OrangeRed;
}

div {
   height:100px;
   text-align:center;
   color:grey;
}
</style> 
 </head> 
 <body> 
  <div id="Wrapper1"> 
   <div id="leftElement1">
     Lorem ipsum do 
   </div> 
   <div id="rightElement1">
     Lorem i 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials