why is my image float breaking the container?

Discussion in 'CSS' started by nix, Nov 4, 2007.

  1. #1
    hi all, can anyone please help me out...

    here is the website

    the problem is that the flags [top area in the header] are breaking the main container and proturding besides setting a definite width for the container..

    the css is valid and so is the html ....
    here's the css code.. any help would be appreciated:


     
    nix, Nov 4, 2007 IP
  2. jBud

    jBud Peon

    Messages:
    387
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    most likely it's because of your padding on the header..
    try this..
    #headcont img
    {
    margin-left: -20px;
    float: right;
    }
    Code (markup):
     
    jBud, Nov 4, 2007 IP
  3. nix

    nix Guest

    Messages:
    116
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks but even with the code you have given im still facing the same issue :(
     
    nix, Nov 4, 2007 IP
  4. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #4
    Remove the padding on #headcont and add margins to the elements inside, and you won't have this problem.

    jBud's example would produce double margins in MSIE6 unless he added display:inline.
     
    soulscratch, Nov 4, 2007 IP
  5. nix

    nix Guest

    Messages:
    116
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i tried removing the padding yet the image flows out... i tried out all position yet it wont fix :(

    btw i found out that removing the doctype declaration solves the problem for ie but still shows up in FFox

    edit: trying soulscratch's method
     
    nix, Nov 4, 2007 IP
  6. jBud

    jBud Peon

    Messages:
    387
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    yeah.. almost forgot that soulscratch...
     
    jBud, Nov 4, 2007 IP
  7. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #7
    Change the CSS to that..
     
    soulscratch, Nov 4, 2007 IP
  8. nix

    nix Guest

    Messages:
    116
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    yay!! :) thanks soulscratch!

    the following worked:

    i would like to ask why was the padding interfereing?
    ??

    especially since i had put a float on the image... [which should float it right to the container which suprisingly didnt contain it properly!]?
     
    nix, Nov 4, 2007 IP