A table-less solution also exists, and is pretty easy to implement. The following uses layering to vertically center an element.
The document would look something like this
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
<head>
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<meta http-equiv='content-language' content='en-us' />
<title></title>
<style type='text/css'>
html, body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
div {
background: yellow;
width: 500px;
height: 500px;
border: 1px solid orange;
position: absolute;
top: 50%;
left: 50%;
margin: -250px 0 0 -250px;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
The ingredients are simple. Position the layer absolutely, offset by 50% from the top and left, then set the top and left margin to a negative value equal to half of the element's width and height.
HTH!
Regards,
Rich
--
[
http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design