In the example below, #logo
is positioned absolutely and I need it to be horizontally centered within #header
. Normally, I would do a margin:0 auto
for relatively positioned elements but I am stuck here. Can someone show me the way?
JS Fiddle: http://jsfiddle.net/DeTJH/
HTML
<div id="header">
<div id="logo"></div>
</div>
CSS
#header {
background:black;
height:50px;
width:100%;
}
#logo {
background:red;
height:50px;
position:absolute;
width:50px
}