|
Posted by cosmic foo on 08/04/05 18:07
"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>
....
> 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.
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.
so who got the crazy idea that web pages should do all that?
>
> --
> Els http://locusmeus.com/
> Sonhos vem. Sonhos vγo. O resto ι imperfeito.
> - Renato Russo -
Navigation:
[Reply to this message]
|