Moving table to middle of the page

thats kinda a newbie question :slight_smile: but i’ve tried valign and align stuff and it didn’t work out, the table is in the center of the page but not in the middle of it
for now im using margin-top to get it alittle bit to the middle, but i dont want to leave it that way…any ideas?


<table align="center" width="1024" height="800" border="0" cellpadding="0" cellspacing="0" style="margin-top:15px;">
....
</table>

thanks in advance

There are lots of good articles on this, such as here:

Here is what I glean from that article:


<!DOCTYPE html>
<html lang="en">
<head><meta charset="utf-8">
<title>Vertical Center</title>

<style type="text/css" media="all">
html,body{
	height:100%;
	margin:0;
	padding:0;
}
body{
	text-align:center;
	min-width:600px;
	min-height:400px;
}

div#vertical {
	float: left;
	height:50%;
	margin-top:-200px;
	width:100%;
}

table#content {
	margin: 0 auto;
	width: 600px;
    background: #eee;
	height: 400px;
	clear: both;
	overflow: auto;
}

</style>

</head>

<body>

<div id="vertical"></div>

<table id="content">
	<tr><td>
	</td></tr>
</table>

</body>
</html>

Hope that helps! :slight_smile:

Sorry, couldn’t resist quoting that!

I maybe I understand it wrong but it looks to me that ulthane want the table vertically centered.

If so?

<style type="text/css" media="all">
#content {position:absolute; top:50&#37;; margin-top:-400px;
</style>

<table align="center" width="1024" height="800" border="0" cellpadding="0" cellspacing="0" id="content">
....
</table>

The negative top margin is half the table height.

Yep. The version I posted is a bit nicer, in that the centered element stays on screen even if the viewport is made very small. Otherwise part of it will disappear.