我正在使用css中的自定义计数器进行打印。但是,当h1标记位于自定义组件内时,计数器似乎会重置。这是一个bug吗?
示例: css:
h1 {
counter-increment: countH1;
}
html:
<h1>hello</h1> -> counter is 1
<h1>hello</h1> -> counter is 2
<my-component>
<h1>hello again</h1> -> counter is 1 again :-(
</my-component>
请注意,my-component是一个自定义元素。这是一个组件(‘my-customElements.define’,myComponent);在JS中的实现。
css计数器与自定义组件不兼容吗?
约翰。
https://stackoverflow.com/questions/51509034
复制相似问题