Search code examples
cssvisual-studio-codefrontendvertical-scrolling

How to fix the unknown property: 'scroll-snap-align' error in visual studio code


I'm trying to add a scroll snap so that each section snaps to the center of the page but i'm getting an unknown property error in VS code so i can't apply it to my code. Is it possible to use scroll-padding-top and scroll-snap-align somehow? do i need an extension maybe?

I've updated to the latest version 1.30.2 but still no joy, i was going to use the depreciated versions of scroll but that didn't seem sensible.

/parent container/

.container {
display: flex;
flex-flow: column nowrap;
box-sizing: border-box;
overflow-x: hidden;
scroll-snap-type: y mandatory;
scroll-padding-top: 150px;
}

/for the child elements/

section {
height: 100vh;
scroll-snap-align:start;
}

i expected the code to snap each section 150px from the top allowing for the menu but nothing happens...


Solution

  • Jon Uleis was right, it did work, for some reason VS Code didn't seem to recognise the feature but it worked fine.