SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: "containing blocks"
-
Jun 20, 2006, 11:42 #1
- Join Date
- Sep 2005
- Location
- Tanzania
- Posts
- 4,662
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
"containing blocks"
Hi, just a quick question. This is a quote from an article by the Autistic Cuckoo (in the "finally" bit:
If you specify the width for an absolutely positioned element, either
explicitly via width in percents, or implicitly
via left and right, the standard says that it should
be computed relative to the containing block. Both Internet Explorer
and Opera get this wrong, unfortunately, and use the width of the
parent element as the basis for their computations.
-
Jun 20, 2006, 12:02 #2
- Join Date
- Jan 2005
- Location
- Netherlands
- Posts
- 4,300
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hello
Not sure what Tommy means, the screen left 0 top 0 is the default zero point for absolute position
If you place absolutes in a relative positioned containing block (usually a div) the zero point for the absolutes will be the left top position of the relative containing block
-
Jun 20, 2006, 15:19 #3
- Join Date
- Dec 2004
- Location
- Sweden
- Posts
- 2,670
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
See the definition of containing block in the spec.
Simon Pieters
-
Jun 20, 2006, 15:25 #4
- Join Date
- Sep 2005
- Location
- Tanzania
- Posts
- 4,662
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Ah, it is to do with whether it has position or not. Thanks for the link.
-
Jun 20, 2006, 22:39 #5
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
For a non-positioned element, the containing block is the same as the parent block.
For an absolutely positioned element, the containing block is the nearest positioned ancestor (where 'positioned' means that it has position set to anything but static).
If there is no positioned ancestor, the containing block defaults to the initial containing block. The spec is vague on what that is, but in reality it's the browser viewport.
Elements with position:fixed always use the viewport as its containing block. (Not supported by IE≤6.)Birnam wood is come to Dunsinane
Bookmarks