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 8 of 8
  1. #1
    Regular Coder
    Join Date
    Oct 2005
    Posts
    336
    Thanks
    43
    Thanked 2 Times in 2 Posts

    What is causing my Div to drop out of sight?

    Im designing the content part of my webpage, it is to be a flexible layout. I have two divs for the content - 'primaryContent' and 'secondaryContent'.

    The secondaryContent div keeps dropping down underneath primaryContent when I make IE or FF etc smaller in width from the right. How can I stop the div from doing this? What do I need to change in my code to keep it where it should be?

    http://www.siteoftom.com/content_section.html

    Thanks!

  • #2
    Regular Coder
    Join Date
    Feb 2007
    Location
    Canada
    Posts
    924
    Thanks
    10
    Thanked 56 Times in 55 Posts

  • #3
    Regular Coder
    Join Date
    Oct 2005
    Posts
    336
    Thanks
    43
    Thanked 2 Times in 2 Posts
    Can anyone elaborate more than just a google answer? I really need a clear explanation if possible

  • #4
    Regular Coder Donkey's Avatar
    Join Date
    Sep 2003
    Location
    Blackfield UK
    Posts
    312
    Thanks
    1
    Thanked 36 Times in 36 Posts
    make your navigation column a % rather than fixed. When you make the page smaller the remaining area is smaller than the sum of the two %'s so the 2nd content div is bumped below.

    I think 8% 42% 42% will work but you will need to adjust margins and padding as well.
    " 90% of everything is crud" - Theodore Sturgeon
    Filthy Beast - a 60's Rock Band

  • #5
    Regular Coder
    Join Date
    Oct 2005
    Posts
    336
    Thanks
    43
    Thanked 2 Times in 2 Posts
    I need the sidecontent to remain a fixed width.

    Making it 8% causes it to loose its "fixedness".

  • #6
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Floats drop when they run out of room. That's what they are supposed to do.
    Both your #sidecontent and #primarycontent fit inside the 450px minwidth you've set on #backgroundDiv so take the float off #secondarycontent and use a margin to position it.
    Like this:
    Code:
    #secondaryContent {margin: 0 0 0 60%;
    	border: thin solid #999999;
    }
    Now, instead of dropping, when #secondarycontent runs out of room it goes behind #primarycontent because your mixing px and % widths.

    % layouts are no fun just because of this.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #7
    Regular Coder
    Join Date
    Oct 2005
    Posts
    336
    Thanks
    43
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Excavator View Post
    Floats drop when they run out of room. That's what they are supposed to do.
    Both your #sidecontent and #primarycontent fit inside the 450px minwidth you've set on #backgroundDiv so take the float off #secondarycontent and use a margin to position it.
    Like this:
    Code:
    #secondaryContent {margin: 0 0 0 60%;
    	border: thin solid #999999;
    }
    Now, instead of dropping, when #secondarycontent runs out of room it goes behind #primarycontent because your mixing px and % widths.

    % layouts are no fun just because of this.
    I've added another div to wrap around both primaryContent and secondaryContent. I called it "contentDiv" and it seems to be stopping secondaryContent from dropping down. I know its another div, but it seems to be doing the trick. Ive given the new div a red border -

    www.siteoftom.com/content_section.html

    Also, what is the best alternative to % layout? I want to keep things flexable, should I consider em elastic layout?

  • #8
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Wow, that's pretty slick. You've found a very elegant solution there.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

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