AMP:如何更改amp-accordion标题的背景颜色?

Mat*_*rks 4 background-color amp-html

我试图改变amp-accordion中标题的背景颜色.我能够做到这一点的唯一方法是应用.-amp-accordion-header无效的样式.

Arn*_*aud 5

如果您尝试.-amp-xxxxx按照其他答案中的建议覆盖类,则AMP验证程序会引发错误.

我通过创建自己的类来解决这个问题:

.myheader {
    background-color:yellow; 
}
Run Code Online (Sandbox Code Playgroud)

我将该类添加到标题中:

<amp-accordion>
    <section expanded>
        <h2 class="myheader">Section 1</h2>
        <p>Bunch of awesome content</p>
    </section>
    ...
Run Code Online (Sandbox Code Playgroud)