Click to See Complete Forum and Search --> : td valign command?


bash
07-02-2003, 08:35 AM
I have created an image, but do not know how to align the image in the middle of the page not the top center.

The command td align=center will place the image in the center of the page but at the top of the page also.

How can i get the image to be excatly in the centre of the web page?

Is it something to do with td valign=middle?

Hope someone can help me?

:-)

pyro
07-02-2003, 08:43 AM
You need to use CSS. Try looking at http://www.infinitypages.com/research/cssverticalcentereddiv.htm

Jonathan
07-02-2003, 01:09 PM
<!-- Put this within the IMG tag -->

<img style="position: absolute; left: 50%; top: 50%;" src="your image.whatever">

pyro
07-02-2003, 01:53 PM
That won't work. That will position the top, left corner of the image in the middle of the screen. If you want to see how to center an element on your page, look at http://www.infinitypages.com/research/cssverticalcentereddiv.htm

Jonathan
07-02-2003, 01:59 PM
showoff... :)

I would have gotten it right but I didn't know you could put the "top" and "left" commands in the style command... lol... Doesn't the margin scrunch the image that is in there too if it is too small for the image, and why are the margins nevagive?

pyro
07-02-2003, 02:10 PM
The margins are negative to offset the top and left by the amount specified. When you set it to half your width and height, you get the center of you element right on the center of the page.