Firefox flexbox image width

后端 未结 4 1978
醉梦人生
醉梦人生 2020-12-06 10:23

I\'m having some trouble getting my image to take up no more than 100% of the available width of the parent container. I\'m only noticing the issue in Firefox 36 (not IE or

4条回答
  •  鱼传尺愫
    2020-12-06 11:20

    I have to admit that I'm not sure why, but for some reason in Firefox it looks like you have to give the image a width/height (i.e. something other than "auto"). Our old friend 100% seems to do the trick:

    .flexbox .middleColumn img {
        width: 100%;
        height: 100%;
        display: block;
    }
    

    Here's a fiddle showing the working solution. Note that I changed the side columns to flex:2 to make the result a bit more apparent.

提交回复
热议问题