Ramin Hossaini's Blog

11Jun/07

CSS: Centering with Position:absolute

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)

Related posts:

  1. Learning CSS – The Basics
  2. Making a ‘Sticky Footer’ in CSS
  3. Funny old school videos
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.

Private
Bear