tags:

views:

103

answers:

2

Hello,


a) What does a browser consider as a page?

Assume monitor has a resolution of 800*600 and we expand browser to take the whole monitor surface area A1. If we resize a browser to an area A1 ( A1 < A) such that it still captures the whole html document ( thus we don’t have to scroll ), then browser considers A1 to be the whole page. But if we again resize browser to an area A2, where scroll bars are needed to view the whole html document, then the size of a page is greater than the displayed area A2.

In this situation, which area does browser consider as a whole page – A or A1?


b) In what circumstances may this information be important ( perhaps when working with absolute or relative positioning or ...)?


thanx


EDIT:

hi


Absolute positioning is relative to a containing block that provides a positioning context; by default, this is the document

a) So if absolute positioning is relative to document, then could we imagine the starting point of a document as a two dimensional coordinate system with origin in top left corner of a viewport (assuming we scroll browser up to the top and to the far left)?


b) I’m assuming browser considers a far right of a viewport also as a far right of a document?! Thus when the width of viewport is 800px, the document also has a width of 800 pixels, but when we resize viewport to 400 px, then width of a document is also 400 pixels? In other words, if some element has a width of 3000px, but if viewport only has width of 400px, then 400px is also the width of document, regardless of element having 3000 pixels in width?


cheers

+4  A: 

A page according to the browser is everything between <body> and </body> tags (semantically speaking - some browsers are forgiving about content present outside <body> tags). The display area is irrelevant and doesn't play any role (except fixed position elements).

So to answer your question, the page is always A. A1 comes into picture only if you have elements with fixed positioning. In fixed positioning, the elements are always positioned relative to A1 even after scrolling/resizing.

Chetan Sastry
+4  A: 

A browser renders (displays) a document. The window is a viewport which gives a view of that document, or part of that document if the rendered document is larger than the viewport.

Absolute positioning is relative to a containing block that provides a positioning context; by default, this is the document. Fixed positioning - i.e. position: fixed; in CSS - positions an element relative to the viewport. One consequence of this is that the element will remain in the same position in the viewport even if the viewport is scrolled so as to view a different part of the rendered document.

NickFitz
+1 for explaining it more clearly than my answer!
Chetan Sastry
hi, I've updated my post in response to your reply ( in case you're willing to help me some more ).In any case, thanx for helping me out
SourceC