SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2005
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    float, position relative/absolute?

    I make 2 column layouts using floats left/right etc and have no problem. I also see many people use Position relative or absolute instead. I don't quite understand how it works. Can anyone explain the difference?

  2. #2
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's usually not a good idea to make a layout with absolute positioning as it means nothing is related to each other - if two elements overlap, they overlap and that's often not good. Let's say you want a footer... If your content is positioned absolutely, you'll have to position your footer absolutely too, which means you'll need to give your content a fixed height, which is probably not good. With floats, you just have to use 'clear:both;' and your footer's sitting exactly where you want it (usually). For two columns, I'd usually use one float and put a left or right margin on the other column...

    I hope this helps a little.

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2005
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Only one column requires the float command? Also... is it wrong to have both columns have a float:left command? I've also seen sites like that.

  4. #4
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It all depends on what you're doing. If your page has a fixed width, then floating everything whichever way will work fine, but if your page is fluid, you may have problems as one float moves below the other.

    See if this or any of the pages it links to are any help to you (the menu's below the main menu on the left).


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
  •