SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mixing relative and absolute width values for containers

    General query here.. I was just wondering if it's a bad idea to have the width of the core layout containers to vary in type? I.e. some are defined in absolute pixels and others in relative percentage values.

  2. #2
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,623
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    It depends . Having a fixed width container and then having percentage childs (aka 800px parent. 50% left and 50% right column width floats. That wouldn't be bad (ignoring rounding errors there)

    But If you had a 80% width container, and then specified px width columns, aka 2 of them 400px (800px total) then if the 80% width container is smaller then 800px then a column would drop . Generally it isn't that bad of an idea on spots of a page
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  3. #3
    Ripe Tomatos silver trophybronze trophy Rayzur's Avatar
    Join Date
    Jun 2007
    Location
    Texas
    Posts
    4,174
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I was just wondering if it's a bad idea to have the width of the core layout containers to vary in type?
    Hi,
    Assuming that your main wrapping div is set as a percentage width would really be the only condition when percentage widths would be effective on the child divs to keep them in relation to the wrapper's width.

    Yes, you could set two divs at 50% wide in a wrapping div that was 800px but they are not going to change so they may as well have been 400px to begin with. However I don't think that is what you are asking.

    In a situation where you have a percentage width set on the wrapper and then defined pixel widths set on two sidebars for example that can be done without causing any problems too.

    Here is an Example where the main center content is given the flexibility to fill the available space between the sidebars.
    The layout is confined to min-max widths so it keeps it usable without the fixed width sidebars ever sitting right beside each other.

    Bottom line is that you need to control it someway so the layout does not break when the space gets limited.

  4. #4
    SitePoint Zealot
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot guys for the input. Insightful read and I'll definitely be taking everything recommended here into consideration.


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
  •