SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    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.
    What is a "containing block"? Is it simply the "youngest" of the parent elements that has position?

  2. #2
    Non-Member
    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

  3. #3
    bronze trophy
    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

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    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.

  5. #5
    SitePoint Author silver trophybronze trophy

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •