Center Absolute Position Element

Posted by Weston Ganger

HTML:


<div class="outer">
  <div class="inner">
  </div>
</div>

CSS:


.outer{
  position:relative;
}
.inner{
  width:100px;
  position:absolute;
  left:50%;
  margin-left:-50px; //half of the width of the element/div/img etc.
}

Article Topic:Software Development - HTML / CSS

Date:May 22, 2014

Recommended Posts