Html css

Center Absolute Position Element

Posted by Weston Ganger on May 22, 2014

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.
}

Posted in HTML / CSS and Tagged with css center 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts