Vertical Float/Positioning

  • Thread starter Thread starter Sonars_UK
  • Start date Start date
S

Sonars_UK

Hi,

I know how to get a table to centrally float horizontally in a window but
how to I get a table to float vertically?

Thanks in advance for any help.

Regards,

Sonars UK
 
Try this out in a browser for an idea:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>
<div id="test" style="width:100%;height:100%">
<table bgcolor="#00FF00" width="100" height="100" border="1"
bordercolor="#000080" id="testTable">
<tr>
<td></td>
</tr>
</table>
<form>
<p><input type="button" value="Button" name="B3"
onclick="centerTable(document.getElementById('testTable'))"></p>
</form>
</div>
<script type="text/javascript"><!--
var hcenter = document.getElementById("test").offsetWidth/2;
var vcenter = document.getElementById("test").offsetHeight/2;
function centerTable(t)
{
t.style.position = "absolute";
t.style.left = hcenter - (t.offsetWidth/2);
t.style.top = vcenter - (t.offsetHeight/2);
}

// --></script>
</body>


</html>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.
 
Back
Top