1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to get a css DIV tag to auto-adjust its height in Firefox

Discussion in 'CSS' started by asimov77, Dec 16, 2008.

  1. #1
    The (Firefox) bug here is that divs seem to not auto adjust thier height to the content that is inside them

    To solve this, you use the 'overflow:hidden;' property in the div tag

    This seems to do the trick without even having to specify a 'height' property for the div

    I have no idea what overflow means, but it seems to solve the problem for ie6, ie7 and FF
     
    asimov77, Dec 16, 2008 IP
  2. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #2
    This is NOT a Firefox bug. Firefox is performing correctly. Parent elements are NEVER to expand to contain floated elements. IE does this but it is a well known IE bug.
     
    drhowarddrfine, Dec 16, 2008 IP
  3. mypsdtohtml

    mypsdtohtml Guest

    Messages:
    96
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Is an Internet Explorer bug, not Firefox
     
    mypsdtohtml, Dec 16, 2008 IP
  4. SiteTalkZone

    SiteTalkZone Peon

    Messages:
    243
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Agreed its to do with IE wrapping floating content when it shouldn't if remember correctly. Firefox has the correct behavior.
     
    SiteTalkZone, Dec 16, 2008 IP
  5. cheapez

    cheapez Active Member

    Messages:
    1,123
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #5
    Add the clear div in the parent div, this makes the parent div to auto adjust its height.

    <div style="clear: both;">&nbsp;</div>
     
    cheapez, Dec 16, 2008 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    See Enclosing Float Elements for an explanation of this and other methods of containing your float elements.

    cheers,

    gary
     
    kk5st, Dec 16, 2008 IP