使 header 符合 amp-html 标准

Make fixed header that is amp-html compliant

amp-validator 不允许在样式表中使用 position: fixed

是否有另一种方法可以使 header 附在顶部并且不会以 amp-conform 方式滚动?

编辑:

完整示例:

<div style="background:red;position:fixed;right:-50px;padding-left:50px;padding-right:50px;transform:translateY(100%) rotate(45deg)">
    <h5>Text</h5>
</div>

这是我收到的错误消息:

[ warn ]  Amp Validation

/  error  CSS syntax error in tag 'div' - the property 'position' is set to the disallowed value 'fixed'.  https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/style_pages

感谢https://whosebug.com/users/2442099/g-cyrillus指出解决方法:

如果position: fixed被用作内联样式,则验证失败。

正在使用

.fixed {
  position: fixed;
}

<div class="fixed" style="background:red;right:-50px;padding-left:50px;padding-right:50px;transform:translateY(100%) rotate(45deg)">

可以说服 amp-validator。