SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    USA
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Absolute vs Float

    In the books I've been reading where examples of how to create column layouts, absolute positioning has been used to make the columns. However, the examples given here and on other sites have used floats. Why would you choose one method over another? What are the advantages/disadvantages of both methods?

    Thanks.

    BaenSidhe

  2. #2
    Put your best practices away. The New Guy's Avatar
    Join Date
    Sep 2002
    Location
    Canada
    Posts
    2,087
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Because if the content ever grew, floats will move accordingly while the other will not.
    "A nerd who gets contacts
    and a trendy hair cut is still a nerd"

    - Stephen Colbert on Apple Users

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    USA
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by The New Guy
    Because if the content ever grew, floats will move accordingly while the other will not.
    When you say move, do you mean a column will expand horizontally?

  4. #4
    Put your best practices away. The New Guy's Avatar
    Join Date
    Sep 2002
    Location
    Canada
    Posts
    2,087
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Lets say you have:

    <div id="header"></div>
    <div id="left"></div><div id="right"></div>
    <div id="footer"></div>

    If #header was say 100px height, and #left and #right were absolute. Then if header became more then 100px height it #left and #right would overlap instead of being moved down.

    Also lets say you have:

    <div id="header"></div>
    <div id="left"></div><div id="right"></div>
    <div id="leftfooter"></div><div id="rightfooter"></div>

    If #leftfooter and #rightfooter were absolute #left and #right would have to be a static height.
    "A nerd who gets contacts
    and a trendy hair cut is still a nerd"

    - Stephen Colbert on Apple Users


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
  •