制作符合amp-html的固定标头

问题描述 投票:0回答:1

放大器验证器不允许在样式表中使用position: fixed

是否有另一种方法可以使标头连接到顶部并且不以与放大器保持一致的方式滚动?

编辑:

完整示例:

<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个回答
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)">

可以确认放大器验证器。

© www.soinside.com 2019 - 2024. All rights reserved.