Image mysteriously ignoring max-width in Firefox & IE

后端 未结 2 1237
醉酒成梦
醉酒成梦 2020-12-14 06:53

So I\'m trying to display images as big as possible with no cropping on any screen size. This means height: 100%; width: auto in landscape and

2条回答
  •  有刺的猬
    2020-12-14 07:23

    You have max-width: 100%, but 100% of what? Of the parent width, right? But the parent is an inline-block (with class="sponsor") whose width is not set, so its width depends on the children, and in particular on the preferred width of the children.

    The layout of this styling is undefined in the CSS specification. In particular, the intrinsic width of the kids in this case depends on the width of the parent which in turn depends on the intrinsic width of the kids. See http://www.w3.org/TR/CSS21/visudet.html#shrink-to-fit-float for the relevant spec text and note all the "does not define" bits.

    I recommend giving your

提交回复
热议问题