Centering help, vertically in transitional.
Hello everyone. I horizontally aligned the table in the center, but how do I vertically align it in the center in Transitional? Just want the table right dead in middle of the page. Thanks!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<link rel="Shortcut Icon" href="something.ico"/>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<meta name="keywords" content="something"/>
<meta name="description" content="something"/>
<body link="black" vlink="black" alink="black">
<table align="center" border="1" cellpadding="0" cellspacing="0">
<td><a href="http://www.something.com"><img src="images/something.jpg" alt="" border="0" /></a> <img src="images/basicinfo.jpg" alt="" border="0" /> <a href="http://www.something.com"><img src="images/something.jpg" alt="" border="0" /></a></td>
I'm 95% certain your page is corrupted, unless the copy/paste feature on this forum isn't working. Try creating a brand new page with the same markup and see what happens, b/c it should work fine.
I did what you asked, it's still the same. The table is centered, but on top. need it on middle of page. Any other suggestions?
* Get the height of the browser.
* Divide it by 2(say x)
* Get the tables height.
* Divide the tables height by 2(say y)
* Calculate x - y
* Wrap the table in a div
* Assign the value to the top property of the div
If you want the table to adjust on change of screen height, put the function on resize event of window
One caution: if you have too large of content (in your case, an image) so it won't fit in computers with small monitors (640x480 or 800x600), they will nto be able to scroll up and down the see the remainder of your content.
The reason I say this is because I see sites do this all the time... especially for computers with large screens.
Another option is the put a table around all your current markup with height and width set to 100% and set the valign on the td that contains everything. This will vertically center everything.
Admittedly, I tried this approach in the past. It's a great workaround that saves time, although it isn't proper practice.
put a table around all your current markup
When I learned web development, professors would scold us if we used tables for formatting. They were uneasy about us using tables for data, even.
Table positioning resource
Adle, here is a good link with info on table positioning. http://www.w3.org/TR/CSS2/tables.html
Hope you find what you need.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)