Getting image to stretch a div

前端 未结 7 447
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 00:34

How can I get an image to stretch the height of a DIV class?

Currently it looks like this:

7条回答
  •  再見小時候
    2021-02-04 01:15

    display:inline  
    float:left  
    

    is your problem

    Floating makes the parents width not be stretched by the child, try placing the image without the float. If you take the float off, it should give you the desired effect.
    Another approach would be to make sure you are clearing your floats at the end of the parent element so that they don't scope creep.

    Update: After viewing your link Your height issue as displayed, is because the floats are not being cleared.

提交回复
热议问题