Amp Breaks Responsive Design of the Custom Logo in Twenty Twenty Theme
I just noticed that the amp plugin breaks the responsive design of the custom logo in the Twenty Twenty theme. Adding this snippet as custom CSS solved the issue.
.header-titles {
width: 100%;
}
I hope this is the right place and way to report this.
Could you provide more context about your setup? For example, the version of the plugin are you using, the template mode you have selected, a screenshot of the AMP page with the issue.
I've tried to replicate your issue with v1.5.5 and v2.0.0-RC2 of the plugin, but I see no visual inconsistencies when in Transitional or Standard mode when viewed from a desktop or mobile device. Likewise, when Twenty Twenty is used as a Reader theme with v2.0.0-RC2 active, I see no inconsistencies there either.
Hi @pierlon Sure. I am running WP 5.5 with Twenty Twenty 1.5 and AMP Version 2.0.0 in standard mode.
Here is a screenshot of the site using Safari 13.1.2 in responsive mode without .header-titles {
width: 100%;
} in custom CSS . As you can see the logo image is not centered and I am able to horizontally scroll to the right.

@mmschwrtz unfortunately I'm still not able to replicate the issue. To be of further assistance, please share your Site Health info with us. You can do so privately via this form: https://forms.gle/PySNjhhxPLrJU6F1A
I've found a way to replicate this. With the following custom CSS added:
@media (max-width:699px) {
.site-logo .custom-logo-link img {
width:365px;
max-height: none;
}
}
Here's what the non-AMP and AMP pages look like when viewed on a mobile device (viewport width < 700px):
| Non-AMP | AMP |
|---|---|
![]() |
![]() |
Both images have the same width and display CSS properties assigned, but the outcome is different as you can see above. This issue seems to be related to https://github.com/ampproject/amp-wp/issues/4418.
This CSS is not part of Twenty Twenty, however. I see it is part of Twenty Nineteen, although the media query is not the same: https://github.com/WordPress/wordpress-develop/blob/0013f5979cb00ee9ad3ac5748b72880594bdbb1c/src/wp-content/themes/twentynineteen/style.css#L3804-L3809
@mmschwrtz Is that something you've added to your site via Additional CSS in the Customizer, for example?
As such, this wouldn't be a bug with Twenty Twenty directly, no?
Yes, I forgot to mention that. It's most likely custom CSS added to the page and not a bug with Twenty Twenty. Also, it does not seem to be a regression introduced in v2.0, I can also replicate it in v1.5.5.
Actually, I think this is behaving as intended. As stated in the layout system spec for the intrinsic layout:
The element takes the space available to it and resizes its height automatically to the aspect ratio given by the width and height attributes until it reaches the element's size defined by the width and height attributes passed to the amp-img, or reaches a CSS constraint, such as max-width.
In this case:
- the image
max-heightis set tonone, so there is no constraint on the height - the parent element does not have a CSS constraint set to limit the width or height of the image
- the image
widthis set to365px, so the image takes up all the space available space until it reaches that size according to its aspect ratio
So I wouldn't consider this as a bug, per se. There's no generic way of solving something like this, so I would say it's best left to the developer to resolve the issue.
Thoughts @westonruter?
Yes, I think you are right.
@mmschwrtz Since you seem to have modified the core theme with custom CSS rules, you'll need to also add all that is required to prevent the intrinsically-sized image from overflowing.
Hi @westonruter I have added some custom CSS rules but none that would explain this behavior:
figcaption.wp-caption-text {display:none;}
div.footer-nav-widgets-wrapper {border-top: 0;}
p.jp-relatedposts-post-date, p.jp-relatedposts-post-context {display: none !important;}
hr.post-separator.styled-separator.is-style-wide.section-inner {height: 0px;color: #ffffff;}
a.more-link {margin-top: 0 !important;}
amp-img[lightbox] {cursor:pointer;}
I just noticed that the site in question is running the Twentig Version 1.1.2 plugin. Maybe this causes the issue?
Indeed. That does seem to be where it is coming from. See https://plugins.trac.wordpress.org/browser/twentig/tags/1.1.2/inc/twentytwenty/index.php#L2795
$logo_responsive_width = get_theme_mod( 'twentig_logo_mobile_width' );
if ( $logo_responsive_width ) {
$css .= '@media(max-width:699px) { .site-logo .custom-logo-link img { width:' . intval( $logo_responsive_width ) . 'px; height:auto !important; max-height: none; } }';
}
You might want to suggest that the plugin author add the necessary CSS to prevent the image from overflowing the available width.

