tags:

views:

296

answers:

2

hi

Absolute positioning is relative to a containing block that provides a positioning context; which by default 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 its origin in the 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 a width of 400px, then 400px is also the width of document, regardless of element having 3000 pixels in width?


thanx


EDIT:

Sorry for keep dragging this:

1)

You can tell the browser to just ignore anything outside the view port

a) Uhm, it seems that overflow property doesn't have much to do with deciding whether browser should provide scroll bars to view the whole element. Instead, it appears this property deals only with content overflowing element's box?!


b) Thus, I assume that even if overflow is set to hidden, browser will still provide horizontal scroll bar if an element has its width set to 3000 pixels?


c) So is there some other property that decides whether horizontal scroll bar should be provided when we have elements wider than viewport?


2)

I'm not sure how this could occur (see A)

i can't be sure, but an element probably had padding and margin properties set to some large number, and browser didn't provide scroll bars, but instead just removed the margin and padding from the element

+1  A: 

A - Yes. However, a viewport isn't always a browser window. For example, a frame is seen as a viewport.

B - It's possible for the document to be larger than the viewport. This is what causes scroll-bars. For example, most sites have a larger height than most browser viewports, which is why many sites have vertical scroll bars.

Ben S
But if width of document is +3000px ( when an element has its width set to 3000px ), then why doesn’t browser provide horizontal scroll bars ( at least in some cases it doesn’t – I wish I could remember what those cases were :( )?
SourceC
Display scroll-bars depends on the CSS. You can tell the browser to just ignore anything outside the view port, or to show scroll-bars with the `overflow` property: http://www.w3schools.com/Css/pr_pos_overflow.asp
Ben S
a) Any idea why horizontal scroll-bars weren't provided even though overfloat was set to visible?b) assuming horizontal scroll bar is provided, when this scroll bar is scrolled as far to the right as it can be, then that point is considered to be a right edge of a document? c) But if no scroll bar is provided ( and thus elements wider than viewport are cliped ), then the width of document equals the width of a viewport?
SourceC
**A-** I can't think of why. Just one browser or more? **B-** Yes, unless upon scrolling, javascript moves or re-sizes something beyond that edge. **C-** I'm not sure how this could occur (see A), but the width of the document must contain all items, even if they're beyond the viewport width.
Ben S
hi - I've edited my initial post (In case you're will to offer me help one more time) - in any case, thanx for helping me out
SourceC
+1  A: 

width of document would then be 3000 , window 400

tho u can use fixed positioning instead of absolute

fixed positioning uses the viewport coords so u can create a non scrolling background for example

n00b32
But if width of document is +3000px ( when an element has its width set to 3000px ), then why doesn’t browser provide horizontal scroll bars ( at least in some cases it doesn’t – I wish I could remember what those cases were :( )?
SourceC