How do I center a div both vertically and horozontally?

Giganews Newsgroups
Subject: How do I center a div both vertically and horozontally?
Posted by:  Tony Vasquez (condorscho…@earthlink.net)
Date: Fri, 05 Sep 2003

Can somoene give me an example of how to center a div, according to it's
image size... I am using different images, and so I have to resize it in a
functino according to the image's size.  So I use a h and w vairable that
give me the height and width of the current image, but I can't seem to come
up with a simple freaking formula to center the image vertically and
horozontally.  Thanks guys.

fnFullView = function () {
var h
var w
var _tempImg = new Image()
_tempImg.onload = function () {
  _tempImg.src = this.src
  h = this.height
  w = this.width
}
_tempImg.src = arPhotolog[currIndex].full

_picGalImage.resizeTo(w,h)
_picGalImage.swapImage(_tempImg.src)
_picGalImage.show()
}

This is the function I am working on, but it really doesn't matter how I do
it.  Thanks guys.

        Tony Vasqsuez

Replies