Link to home
Start Free TrialLog in
Avatar of surfjoe
surfjoe

asked on

HTML to CSS: Center the page vertically and horizontally instead of (<table height="100%">)

HTML to CSS: Center the page vertically and horizontally instead of (<table height="100%">)


I have tried this solution it works in firefox but  not IE
 
.centered {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 50%;
  height: 50%;
  margin: auto;

}

I have also tried this solution it works unless the browser window is to small and the top of the page is then cut of losing the navigation not that ideal...

.centered   {
  width: 932px;
  height: 606px;
  left: 50%;
  top: 50%;
  margin-left: -466px;
  margin-top: -303px;
  position:absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;}

Any ideas?
Avatar of sejr
sejr

Try this, it seems to work for me.

left-margin: auto;
right-margin: auto;
top-margin: 0px;
top-padding: 0px;

try giving,

<table align="center">

Regards -G.
Avatar of Nancy Rindone
Is this what you're trying to accomplish?

http://www.resqteknowledgies.com/dev/ee/test2.htm
you can center a div horizontally by using text-align:center in the style
Avatar of surfjoe

ASKER

This is what i'm trying to accomplish http://www.resqteknowledgies.com/dev/ee/test2.htm but I need to be able to view the top of the page by scrolling if opened in a small browser window. If you resize the window on this link you will see that it is impossible to view the top of the box. Maybe there is a way to do this with java script?
ASKER CERTIFIED SOLUTION
Avatar of Nancy Rindone
Nancy Rindone
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial