【问题标题】:Make fixed header that is amp-html compliant制作符合 amp-html 的固定标头
【发布时间】:2020-03-03 06:01:21
【问题描述】:

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

是否有另一种方法可以制作附加到顶部且不以 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

【问题讨论】:

标签: css amp-html


【解决方案1】:

感谢https://stackoverflow.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。

【讨论】:

    猜你喜欢
    • 2017-03-01
    • 1970-01-01
    • 2016-08-11
    • 1970-01-01
    • 2017-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-11
    相关资源
    最近更新 更多