Reply to Re: how to vertical align a site to the center of the screen

Your name:

Reply:


Posted by Els on 08/03/05 18:52

cosmic foo wrote:

> "Els" <els.aNOSPAM@tiscali.nl> wrote in message
> news:1n8y416rnnaga.m2q57qr5zrl7.dlg@40tude.net...
>> 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?
>>
>
> hey, you're right, thanks.
> this works a lot better,
> <div id="abc" style="position: absolute; top: 0px; left: 0px; width:
> 800px;">
> <script language="JavaScript" type="text/javascript">
> document.getElementById("abc").style.left =
> Math.max(0,(document.body.clientWidth - 800)/2) + "px";
> </script>
> ...

Still doesn't mean anything to me - as I said, I don't read
JavaScript. I'll take your word for it :-)

>> 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?
>
> dude, it looks the same.

You mean the letters are bigger and there is no problem with your
absolutely positioned boxes? Well done :-) URL?

> when you watch tv, you don't expect things
> to get larger or smaller by pushing a button, you purchase bigger
> hardware to solve the problem, or you sit closer or farther away.

Right! My Mum sits closer to my TV than I do (I have a small TV), to
read the subtitles.
However, those subtitles are the same size across all channels and
programms. Now look at the variaty of websites. Tell me, which monitor
should my Mum buy? Wouldn't it be much easier if she could just set
her browser to not accept fonts any smaller than 20px? And if she
bought a 23inch monitor to make sure she still gets to see whole
sentences? Then you will just tell her 'sorry, but I prefer absolute
sizes in my designs, so you can't read what I wrote'.
That's fine for your personal website, but would your clients like to
lose my Mum as a customer?

> so who got the crazy idea that web pages should do all that?

Someone's missing a clue here.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Human League - Together in Electric Dreams

[Back to original 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

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