Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<figure> element wrapping an <amp-img> element is mis-sized #25032

Closed
schlessera opened this issue Oct 14, 2019 · 2 comments
Closed

<figure> element wrapping an <amp-img> element is mis-sized #25032

schlessera opened this issue Oct 14, 2019 · 2 comments

Comments

@schlessera
Copy link
Contributor

What's the issue?

When wrapping an element with layout="intrinsic" in a

element, the wrapping has a height that is a few pixels larger then the image it wraps.

This problem seems to be unrelated to any CSS being parsed, so I assumed this is JavaScript behavior inside the element that is broken.

Image 2019-10-14 at 11 53 04 AM

How do we reproduce the issue?

Markup to reproduce:

<figure>
    <amp-img src="https://via.placeholder.com/580x300"
             width="580"
             height="300"
             layout="intrinsic"></amp-img>
</figure>

See https://codepen.io/schlessera/pen/BaaKaxo

What browsers are affected?

Tested in Google Chrome Version 77.0.3865.120 (Official Build) (64-bit)

Which AMP version is affected?

Seen in version 1910071803120.

@westonruter
Copy link
Member

I think this might just be a CSS issue and may not be a problem with AMP. See ampproject/amp-wp#3493 (comment)

@schlessera
Copy link
Contributor Author

The problem seems to stem from the fact that AMP sets the <amp-img> with an intrinsic layout to display: inline-block;, whereas the original image was styled to be display: block;.

I'm closing this issue as being a CSS problem, not a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants