HTML CSS examples for CSS Layout:Div Align
Align several nested div's of a div to the center
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #parent {<!-- w w w . j a va 2 s. co m--> float:left; height:100px; width:481px; margin-top:56px; text-align:center; border:2px solid Chartreuse; } .d { background:yellow; width:106px; margin:0 auto; border:2px solid blue; } </style> </head> <body> <div id="parent"> <div id="menu_0" class="d"> Lorem Ipsum </div> <div id="menu_1" class="d"> Lorem Ipsum </div> <div id="menu_2" class="d"> Lorem Ipsum </div> </div> </body> </html>