Making a div the same size as an image inside it

前端 未结 7 2300
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-13 12:21

I have an div with the following code

HTML:

7条回答
  •  后悔当初
    2021-02-13 12:35

    Try this:

    div#imgContainer {
        min-width: 250px;
        min-height: 250px;
        padding: 13px;
        display: inline-block;
    }
    

    Fiddle

    Thanks to @ahren and @Mohsen

提交回复
热议问题