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 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts