I want to apply smooth scrolling only to a very specific page in nextjs (say my blog). So I am not using my globals.css
file, but I need a way to inject scroll-behavior: smooth;
into the html tag for specific pages only, not for my whole site.
I believe that there is a way to do this with css modules, but I do not understand how it works. Here is explained how this would work with css classes, but I don't understand how this would look like for my use case, where I try to target the html tag?
Any advice?
I tried this:
.foo :global {
html {
scroll-behavior: smooth;
}
}
and this:
html :global {
.foo {
scroll-behavior: smooth;
}
}
But I get:
Syntax error: Selector "html :global" is not pure (pure selectors must contain at least one local class or id)