Getting image to stretch a div

前端 未结 7 444
被撕碎了的回忆
被撕碎了的回忆 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:05

    One trick you can use is to set the

    's overflow property to hidden. This forces browsers to calculate the physical size of the box, and fixes the weird overlap problem with the floated image. It will save you from adding in any extra HTML markup.

    Here's how the class should look:

    .product1 {
        width: 100%;
        padding: 5px;
        margin: 0px 0px 15px -5px;
        background: #ADA19A;
        color: #000000;
        min-height: 100px;
        overflow: hidden;
    }
    

提交回复
热议问题