Help with making a parent div expand with child

Discussion in 'HTML & Website Design' started by mcdeere02, Aug 5, 2009.

Thread Status:
Not open for further replies.
  1. #1
    So I have the post headers here.

    http://www.couponmom.com/blog/

    But they dont scale properly when the title is multiple lines like here.

    http://www.couponmom.com/blog/2009/01/396/


    I would like the bottom to get pushed down if the header is multiple lines.

    Thanks
     
    mcdeere02, Aug 5, 2009 IP
  2. AssistantX

    AssistantX Peon

    Messages:
    173
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There are a few issue at play with those headers:

    When you float an element, it is taken out of the normal flow of the parent element. Therefore, when the floated element stretch in length, it will usually not stretch the length of its parent. On your website, your titles are floated left. To solve this issue, I recommend setting the parent element to CSS "overflow: auto;". With that property, browsers would stretch the parent element around the length of the child element. (Note: If your lucky, IE won't put a scrollbar instead.)

    Though the div may stretch appropiately, the background will not. In CSS 2-, web developers do not have the ability to stretch the background. In order to do that, you would have to use CSS 3, however CSS 3 is not fully supported in all browsers especially IE since CSS 3 is still in development. Until CSS 3 becomes official, you may want to rework the way you do your backgrounds.
     
    AssistantX, Aug 5, 2009 IP
Thread Status:
Not open for further replies.