SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot theslip's Avatar
    Join Date
    Jun 2008
    Location
    here
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    quick float question guys : )

    Hi there, I've been working with float layouts for a while now but have a question you smarter people will be able to help with.

    Now I always float my divs, containers, but almost never my p,h1,h2 and so on within the div containers, is this correct or should I be floating everything?


    The reason I ask is sometimes I have maybe a table in a floated container div and it pops to the right in safari, I use a float to align it back in but paragraphs underneath it go strange.

    Should I be floating everything inclusing p,h1, h2 or am I fine to do either? Big thanks in advance you clever people ya!

  2. #2
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,761
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    No you should not be floating everything. It sounds like the "paragraphs underneath it" just need a clear on it. Aka clear:both
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  3. #3
    SitePoint Zealot theslip's Avatar
    Join Date
    Jun 2008
    Location
    here
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah cool, I must admit I've only cleared on floats can you use clear on non floated objects? cheers Ryan

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,549
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    can you use clear on non floated objects?
    Yes you can use clear on all block level elements and in most cases you would probably be using it more than you do on floated elements for the reason that you want following content to clear the floated content above.

  5. #5
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,761
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by theslip View Post
    ah cool, I must admit I've only cleared on floats can you use clear on non floated objects? cheers Ryan
    Also if you need shrink wrap behavior then you will also be using a clear on it, because a float/clear create a new line for every float
    Always looking for web design/development work.
    http://www.CodeFundamentals.com


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
  •