Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CSS to measure browser window

0 views
Skip to first unread message

Andy Goldberg

unread,
Oct 17, 2001, 7:17:33 AM10/17/01
to
I used the following dynamic CSS to create a DIV tag that places itself in
the bottom-right corner of the browser window (specifically, the bottom 1/3,
the right 1/2). It works great (in IE5, I haven't tested it anywhere else
yet), the user can resize the window all he/she wants and the DIV resizes
itself perfectly. The problem is, if the underlying page is long enough to
be scrollable, when the user scrolls down then the DIV tag scrolls right up
the screen with everything else... it pretty much ruins the effect.

<div class="corner" style="top: expression(2 * body.clientHeight / 3);
height: expression body.clientHeight / 3);
left: expression(body.clientWidth / 2);
width: expression(body.clientWidth / 2);">
bla bla bla my text is here
</div>

Is there another measurement I should use instead of "body.clientHeight"
that won't be affected by scrolling? Does anyone know where to find some
documentation on measuring browser windows, etc.?

Thanks!

-Andy

Eric Carr

unread,
Oct 22, 2001, 6:09:23 AM10/22/01
to
You need to move your div along with the scrolling; add
body.clientHeight to body.scrollTop and you're set !

- Eric

0 new messages