Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

Vertical centering of DIV

3:04 am on Sep 13, 2006 (gmt 0)

Full Member

10+ Year Member

joined:Feb 4, 2005
votes: 0

When a user clicks a button (such as to upload an image) I would like to overlay a DIV that is vertically aligned in the middle of the page that shows feedback (i.e. "Uploading...Please wait").

I'm clueless, I was thinking maybe displaying the container div as a table, and using vertical-align, but i'm not sure this will do it.

Any ideas?

3:42 am on Sept 13, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Feb 28, 2005
votes: 0

If it's fixed-width, fixed-height, this can be done quite easily.

You want it positioned over the top of everything else, so:

  1. fix the width and the height of the
  2. absolutely position;
  3. set
    to 50%;
  4. set negative margin which is half the amount (e.g. if width = 600px, height = 300px, set
    = -300px,
    = -150px); and
  5. set your
    higher than your other elements, to position it above everything else.

That's it :)


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members