centre content x (pos abs and translate to pull child content back to centre)
by ian_smithz
HTML
<div id="parent">
<div id="child">
</div>
CSS
#parent {
width: 300px;
height: 200px;
background-color: black;
border: 1px solid grey;
position: relative;
}
#child {
position: absolute;
height: 100px;
width: 20px;
left: 50%;
top: 0;
transform: translateX(-50%);
-webkit-transform: translateX(-50%);
background-color:red;
}