Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2004
    Location
    London, England
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    position: absolute; not working as I expect (IE6)

    It looks to me as if specifying position: absolute; positions the element relative to the start of the document, not to the start of the containing block as my book says.

    What am I missing here?

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    You're missing the definition of "Containing Block". Containing block is not the same as parent. The containing block is the closest positioned ancestor. (I.e. the closest ancestor that has it's position property set to a value other than static.)

    The fix for your problem is to add position: relative; to the element you want the absolutely positioned element to be relative to.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    New Coder
    Join Date
    Jan 2004
    Location
    London, England
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by liorean
    You're missing the definition of "Containing Block". Containing block is not the same as parent. The containing block is the closest positioned ancestor. (I.e. the closest ancestor that has it's position property set to a value other than static.)

    The fix for your problem is to add position: relative; to the element you want the absolutely positioned element to be relative to.
    Hah, my understanding is way more broken than I thought but thank you, this should fix me up.


  •  

    Posting Permissions

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