When I enter the code
html {
scroll-behavior: smooth;
}
I get the smooth effect that I want for anchor links. However, I only want this effect to apply to a single page, not my whole site. So I thought that perhaps this would work, using the class for the body tag of the single page that I want this effect on.
.landing-page {
scroll-behavior: smooth;
}
However, once I do this the effect doesn't work, even though using the inspect tool shows that this attribute is applied to .landing-page. Why isn't it working, and what should I try next?
EDIT:
Here is the HTML. I am trying to have it that I smooth scroll to #how-it-works and only that anchor.
<body class="landing-page welcome">
<div class="page first">
<div class="container">
<div class="heading">
<a class ="anchor" id="how-it-works"></a>
<span class="primary-text">
You have before you the best system for deeply learning math.
</span>
<span class="secondary-text">
Online, real tutors, at your own pace. Ask anything.
</span>
</div>
</div>
</div>
</body>