Suppose I fill an invisible div with text, then make it visible and try to center it...

Suppose I fill an invisible div with text, then make it visible and try to center it...

Suppose I fill an invisible div with text, then make it visible and try to center it on the screen, both vertically and horizontally.  I can fix the width of the div in advance, but I can't fix the height in advance, since I don't know how much text I'm going to be putting in.
To get the div height, I do:   var divheight = $('#popup').outerHeight()
but this returns 'undefined'.

to be a little more precise, I have a table in the div, and it has 2 rows with one cell each, and I'm filling the text into the bottom TD.

Thanks.