-
Notifications
You must be signed in to change notification settings - Fork 384
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
Images unexpectedly expand to fill containers #1104
Comments
Initial Findings So far, this looks to be related to the That has the style rule .aligncenter {
clear: both;
display: block;
margin-left: auto;
margin-right: auto;
} And that seems to override the rule that AMP has for .i-amphtml-layout-intrinsic {
display: inline-block;
...
} |
Hi @kienstra, Thanks for hopping in and thanks @westonruter for reporting! I added a user story/AC here. |
The The issue can be seen in 1.0-alpha as well on https://amp-make-xwp.pantheonsite.io/2016/07/24/dependently-contextual-customizer-controls/ |
Simple Way To See Bug Another simple way to see this bug is to add the class |
Legacy Templating: Images Used To Be Centered A related issue is that in the previous version, We should probably try to keep it that way in version Background https://ryankienstra.wordpress.com/2018/05/01/test-page/amp/ This style rule used to center all of the images without the classes .amp-wp-article-content amp-img {
margin: 0 auto;
} In .i-amphtml-layout-intrinsic {
display: inline-block;
...
} As I understand it, applying left and right margins of For example, this post uses the plugin version However, this could have been caused by my removal of the sizes attribute in #937. We could output different layouts for "Legacy Templating," by using |
And it is illegal to add our own style rules that target |
As I've looked into the issue, I've noticed that there's no problem with images having captions: It turns out that when you add a wrapper element that has a defined width and the We've investigated the issue with @kienstra and came up to such solution:
Thanks to that the image should not get stretched horizontally, it should be centered and in case it's wider than the container, it won't overflow. |
Hi, Unfortunately, inline styles are not supported by AMP. Could we reconsider this? |
@mustafauysal You're right that inline styles aren't allowed by AMP, but the AMP plugin does support them by converting them into CSS style rules via selectors with generated CSS class names. |
@westonruter Oh! I see now. We are using custom sanitizers, that's why I've looked to the wrong place at first. Thanks for the clarification. |
This is being revisited in #2036. Please test. |
As @westonruter pointed out, images can sometimes appear horizontally stretched.
This issue sometimes appears when images have less width than their container.
Appears on
Steps To Reproduce
0.7
branch of this plugin600px
, like this image (update: and center-align the image)/amp
or?amp=1
to the URL)Expected: it appears at its natural dimensions (300x232 for the example above)
Actual: it appears stretched (see image above)
This may be related to #937.
The text was updated successfully, but these errors were encountered: