HTML CSS examples for CSS Layout:2 Column
position two divs next to each other, one of them is centered in the container of both divs
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #container {<!--from w w w.j a v a2 s .co m--> width:100%; display:table; height:61px; color:Chartreuse; } #div1 { margin-left:auto; margin-right:auto; width:201px; height:51px; background-color:yellow; display:table-cell; } #div2 { display:table-cell; height:51px; background-color:blue; margin-right:0; float:left; width:100%; } </style> </head> <body> <div id="container"> <div id="div2"></div> <div id="div1"> </div> </div> </body> </html>