This is an example of how one would center something Vertically inside a division

This is the outer DIV
This is text in the inner DIV

This is the source of the above example:

<html>
<head>
<script>
function InitPage() {
     one.style.top = 50;
     two.style.top = one.offsetHeight/2 - two.offsetHeight/2;
     two.style.left = one.offsetWidth/2 - two.offsetWidth/2;
}
window.onload=InitPage;
</script>
</head>

<body>
text in beginning<br>

<div id=one style="position:absolute; top:10; height:200;width:200;background-color:green">
     text in the outer DIV
     <div id=two style="position:absolute;left:50;width:100;color:red; border:red 2px solid">
          text in the inner DIV
     </div>
</div>

</body>
</html>





© 1999 Microsoft Corporation. All rights reserved. Terms of use.