Re: FAQ Topic - How do I find the size of a browser window?
- From: "Richard Cornford" <Richard@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 22 Aug 2006 23:12:36 +0100
Lasse Reichstein Nielsen wrote:
Trond Michelsen <trondmm-usenet@xxxxxxxxxxxx> writes:
I'm pretty new to javascript, so it's not very obvious to
me how the size of a browser window is irrelevant. Let's
say you want to position a fixed element in the bottom
right corner of the window, what's the preferred method
of doing this?
CSS, e.g.
#botright { position: fixed; bottom: 0px; right:0px; }
However, that only works in browsers with CSS 2 support,
ruling out IE. Should you try to position (and continously
reposition) the element using javascript, you still don't
care about the window size.
Which doesn't mean that IE cannot do this with just CSS. If an
absolutely positioned block element is a child of the BODY element, has
bottom and right CSS properties set to zero and the width and height of
the BODY (and the HTML elements) are set to 100% then the will stay in
the bottom right of the viewport (more or less):-
<html>
<head>
<title></title>
<style type="text/css">
HTML, BODY {
width:100%;
height:100%;
margin:0;
padding:0;
}
#atBottomRight {
position:absolute;
bottom:0;
right:0;
margin:0;
padding:0;
font-weight:bold;
font-size:150%;
margin:0;
padding:3px;
color:#FFFFFF;
background-color:red;
}
</style>
</head>
<body>
<p>
xxx xxxxxxx xxxx xxxxx xx xxxxxx xxxxxxxxx xxx xxxx xxxx
xxx xxxxxxx xxxx xxxxx xx xxxxxx xxxxxxxxx xxx xxxx xxxx
xxx xxxxxxx xxxx xxxxx xx xxxxxx xxxxxxxxx xxx xxxx xxxx
xxx xxxxxxx xxxx xxxxx xx xxxxxx xxxxxxxxx xxx xxxx xxxx
xxx xxxxxxx xxxx xxxxx xx xxxxxx xxxxxxxxx xxx xxxx xxxx
xxx xxxxxxx xxxx xxxxx xx xxxxxx xxxxxxxxx xxx xxxx xxxx
xxx xxxxxxx xxxx xxxxx xx xxxxxx xxxxxxxxx xxx xxxx xxxx
</p>
<div id="atBottomRight">Some Text</div>
</body>
</html>
Richard.
.
- References:
- FAQ Topic - How do I find the size of a browser window?
- From: FAQ server
- Re: FAQ Topic - How do I find the size of a browser window?
- From: Matt Kruse
- Re: FAQ Topic - How do I find the size of a browser window?
- From: Richard Cornford
- Re: FAQ Topic - How do I find the size of a browser window?
- From: Matt Kruse
- Re: FAQ Topic - How do I find the size of a browser window?
- From: Richard Cornford
- Re: FAQ Topic - How do I find the size of a browser window?
- From: Randy Webb
- Re: FAQ Topic - How do I find the size of a browser window?
- From: Trond Michelsen
- Re: FAQ Topic - How do I find the size of a browser window?
- From: Lasse Reichstein Nielsen
- FAQ Topic - How do I find the size of a browser window?
- Prev by Date: Re: FAQ Topic - How do I find the size of a browser window?
- Next by Date: Re: Tabber() was: Re: Daylight Saving Time
- Previous by thread: Re: FAQ Topic - How do I find the size of a browser window?
- Next by thread: Re: FAQ Topic - How do I find the size of a browser window?
- Index(es):
Relevant Pages
|