#tailwind `scroll-smooth` not working between elements

1 messages · Page 1 of 1 (latest)

wintry raptor
#

In my Layout I've defined smooth in the body

<body class="scroll-smooth">
        <Navbar />
        <slot />
...etc

Inside the main index.astro I have a button that calls to another part of the page, in a different element. For example:

<Hero> <--- contains the button to href="#why"
<Features> <--- root div has the ID set to to why

But it's not smooth scrolling. I'm still quite new to a "component based system" and wondering how I could achieve this? Both Hero and Features are .astro files if that helps!

pulsar canopy
#

I think it needs to be set on the html element

wintry raptor
#

Today I learned! Don't know why I didn't try that 😅 ExpressJS I could do it on the body, but good to know. Thank you very much!