amp-img with layout responsive doesn't work in flexbox #21790
Labels
Component: amp-img
P3: When Possible
Type: Bug
Type: DevX
issues impacting developer experience
WG: components
Repros in Chrome here: https://codepen.io/cathyxz/pen/wZgQqY?editors=1100
Basically today @kristoferbaxter discovered that when you have:
and
in AMP, the
<amp-img>
does not display. =(It turns out that the dimensions of both the
<amp-img>
and thesizer
are 0x0, and therefore the<img>
tag is not rendered because thelayoutCallback
is not called.This does work with
layout="intrinsic"
though, andlayout="responsive"
will work correctly as intended if we set theflex-basis
property on the<amp-img>
. But not out of the box. Since this is a commonly used pattern for centering images, it seems like we should document this behaviour and workarounds at least.The text was updated successfully, but these errors were encountered: