HTML CSS examples for CSS Layout:Absolute Position
horizontally center an absolute positioned element inside a 100% width div
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #header {<!-- w w w . j av a 2 s . c o m--> background:black; height:51px; width:100%; } #logo { background:red; height:51px; position:absolute; width:51px; margin:0 auto; right:0; left:0; } </style> </head> <body> <div id="header"> <div id="logo"></div> </div> </body> </html>