amphtml
amphtml copied to clipboard
[amp-viewer]Fixed/sticky elements have layout issues inside amp-viewer.
What's the issue?
Fixed/sticky elements have layout issues.
How do we reproduce the issue?
Fixed elements: (Mobile Browser: Chrome 75.0.3770.85 iOS 12.1.2)
- Visit amp page link and amp viewer link
- Inside amp-viewer, the header of the page is covered by viewer header. It should be displayed below the viewer header.

Sticky elements: (Desktop browser: Chrome 75.0.3770.90 Mac 10.14.5)
- Visit amp page link and amp viewer link
- Please scroll down the page inside amp-viewer. The sticky element (
header.ap--header) moves out of the viewport.
AMP page screenshot:

AMP page inside amp-viewer screenshot:

Which AMP version is affected?
1906141418310
@jridgewell Hey Justin, not sure if you are the right one to ask :) Since fixed and sticky elements can not display perfectly as intended, what is the best solution/workaround to implement a sticky header?
You need to set a top: 0 style on the element that is actually position: fixed. In your case, it should be on the div.header_main element, not the header element.