HTML CSS examples for CSS Layout:2 Column
Positioning two div elements with one centered
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .container {<!--from ww w . ja v a 2s.co m--> text-align:center; position:relative; } .center { width:100px; height:100px; background-color:Chartreuse; display:inline-block; } .right { width:100px; height:100px; background-color:yellow; position:absolute; top:0; left:calc(51% + 51px); } </style> </head> <body> <div class="container"> <div class="center"></div> <div class="right"></div> </div> </body> </html>