You are here: Re: how to vertical align a site to the center of the screen « HTML « IT news, forums, messages
Re: how to vertical align a site to the center of the screen

Posted by Els on 08/03/05 16:46

cosmic foo wrote:

> i was just working on a similar problem.
> the client wants the page to be filled at 800x600,
> and centered if 1024x768.
> so i came up with this (which i have a feeling is not so great,
> but it seems to work in ie and firefox),
>
> <div id="abc" style="position: absolute; top: 0px; left: 0px; width:
> 790px;">
> <script language="JavaScript" type="text/javascript">
> document.getElementById("abc").style.left = (screen.availWidth -
> 800)/2 + "px";
> </script>
>
> ..a bunch of absolute positioned divs..
>
> </div>

Not too sure about the script (I don't speak JavaScript), but doesn't
that mean centered in a maximized window only?
Like, if my screensize is 1600x1200, and my browserwindow is only
800x600, I'll only see the top left quarter of the page?

And out of curiosity, wrt to the 'bunch of absolute positioned divs':
what does your page look like when I make the text twice as big?

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация