Ramin Hossaini

CSS: Centering with Position:absolute

Jun
11

If you’re working with absolute positions in CSS, then you’ll love this:
http://bluerobot.com/web/css/center2.html

Simple in theory:

  • Set position to absolute;
  • set left:50%;
  • and then set margin-left:-##px; (where ## is half the width of the object)

Leave a Reply

Your email address will not be published. Required fields are marked *