When I use float I lose the background

Discussion in 'CSS' started by kapadokis, Oct 28, 2009.

  1. #1
    Hi all...

    I have an smf forum and I wanted to use two columns of text, but when I use the float element I lose the background. Is something I can do to extinct this???
     
    kapadokis, Oct 28, 2009 IP
  2. Raster Factory

    Raster Factory Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need an element below both floated columns that will clear both of them.

    Put this under both columns, but before the ending of the wrapper containing the background:

    <p style="clear:both"></p>
     
    Raster Factory, Oct 28, 2009 IP
  3. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #3
    It is important that you understand how floats work relative to their surroundings. See enclosing float elements for the cause of your problem.

    cheers,

    gary
     
    kk5st, Oct 28, 2009 IP
  4. kapadokis

    kapadokis Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I add this code with no results!
    U mean I have to add this at end of each column separately or one time?
     
    kapadokis, Oct 28, 2009 IP
  5. kapadokis

    kapadokis Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Oh, yes I understood what you said...
    It works fine!!! Thank you very much my friend.
     
    kapadokis, Oct 28, 2009 IP
  6. LeetPCUser

    LeetPCUser Peon

    Messages:
    711
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Another thing you can look into, which is very helpful is the clearfix. You can Google it. It helps clear problems like this across browsers.
     
    LeetPCUser, Oct 29, 2009 IP