Computer Science Canada Centering a page vertically |
Author: | Shaun Dreclin [ Sat Jun 10, 2006 2:31 pm ] |
Post subject: | Centering a page vertically |
Well I know it should be simple, but I dont have any idea what the code is! |
Author: | Shaun Dreclin [ Sat Jun 10, 2006 2:32 pm ] |
Post subject: | |
Hmm... Maybe its something like valign center.. *goes to try that* |
Author: | wtd [ Sat Jun 10, 2006 3:00 pm ] |
Post subject: | |
There is no reliable way to do it. |
Author: | rdrake [ Sat Jun 10, 2006 3:10 pm ] |
Post subject: | |
Like wtd said, there's no real way to do it easily and effectively. You could use a bunch of <br /> tags, but then that doesn't work at all resolutions. You could use Javascript, but that too creates problems with many browsers. You could insert a table which covers the entire screen and add a <td valign="middle"> in there, but that's far from proper technique. Honestly there's no easy way to do this, and it's not recommended you use one of the above techniques to do it either. |
Author: | [Gandalf] [ Sat Jun 10, 2006 3:22 pm ] |
Post subject: | |
Just use a table and valign that. When your using plain HTML for anything more than an insignificant page it's almost impossible to write "proper" code. ^Advice from years of web development experience. |
Author: | Amailer [ Sat Jun 10, 2006 6:16 pm ] | ||
Post subject: | |||
won't
work? |
Author: | md [ Sat Jun 10, 2006 6:45 pm ] |
Post subject: | |
That does centering left/right (in some browsers... forget about most versions of IE). Vertical centering is rather difficult though. Fortunately it's almost always pointless... so unless you have a really reason it's not worth hacking together. |