using nested class
flowen opened this issue · comments
I wanted to style a sticky element using some JS to detect by toggling a class
I tried the following:
`
.root {
position: sticky;
z-index: 100;
top: 0;
background: var(--color-black);
top: -1px;
padding-top: 1px;
&.is-sticky {
background: red !important;
}
}
`
I noticed the parced CSS is:
.header-module--root--Wc7zx.header-module--is-sticky--3NGPO{ background:red !important }
I wouldn't be able to style the toggled class this way.
I guess the ID at the end comes from postcss-modules (?)
@flowen I think you should use :global(&.is-sticky) {
or &:global(.is-sticky) {
. Try smth like this