Results 1 to 2 of 2

Thread: Overflowing Div in Absolute Div

  1. #1
    Join Date
    Feb 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Overflowing Div in Absolute Div

    Hello everyone!

    I have a small problem which I would like some help with. I have a few absolute positioned divs with static width and height (300px) and would like them to contain amongst other a header, a non-static div (or any other suiting structure apart from iframe) with a long list (ul/li) and a footer. The problem I get is when the list is too long for the "container-div" it pushes all objects below out of the div-area.

    PHP Code:
    ------------------------------------------
    ||                  
    Header                        
    ------------------------------------------
    ||                                                     
    ||                  
    Inner-DIV                       
    ||                                                      
    ||        
    Overflow-scroll on this only     
    ------------------------------------------
    ||                  
    Footer                            
    ------------------------------------------- 
    - If I set "overflow: auto" or "overflow: scroll" to the "container-div" it won't push the objects outside of the box but put them at the bottom of the scroll which I don't want to happend.

    - If I set "overflow: auto" or "overflow: scroll" to the "inner-div" it still pushes the objects outside of the box (shouldn't the list overflow the inner-div? I guess it doesn't since it has no static height).

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This isn't very clear to me but, I can tell you a few things that may help. The overflow property tells the browser what to do with the content of an element that won't fit inside it. Using auto is usually meaningless except for situations where you want scrolling in only one dimension. Scroll will give you scroll bars in both dimensions whether needed or not. There are other choices. The two most relevant being 'hidden' and 'visible'. Unfortunately, once you make a container's position absolute or relative, often (but not always) these two will not work as expected, that aside for the moment, it sounds like you want overflow:visible for one or more of the divisions, this allows the content to be seen outside of the element's content area. That is as long as there is no other containing element around the overflow:visible element that confines it.

    You may in fact be over styling things. The effect you want may be able to be achieved with a single division with no position property set and its overflow set to visible.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •