Potential CSS Scroll Snap bug in Chrome (Windows). Two examples, only one work. Why?

前端 未结 1 1646
没有蜡笔的小新
没有蜡笔的小新 2021-01-16 09:17

Here are two CSS scroll-snaps examples from csstricks.com

  • Example #0 works on Chrome on Windows
  • Example #3 does not work

Why does one o

相关标签:
1条回答
  • 2021-01-16 09:54

    Because by default the <body> doesn't scroll, <html> does.
    Change the selector to :root and it will work in Chrome.

    Though to be safe you'd be better defining your own scrolling area since older browsers were indeed using <body> as scrollingElement.

    0 讨论(0)
提交回复
热议问题