Learn CSS Scroll Snap In 6 Minutes

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024

ความคิดเห็น • 182

  • @cafelutsa_
    @cafelutsa_ ปีที่แล้ว +92

    If I remember correctly, you can emulate touch controls inside the devtools by choosing a device from the dropdown (be it tablet or phone)

  • @abdulahadqureshi1104
    @abdulahadqureshi1104 ปีที่แล้ว +22

    Thanks for the great tutorial. I first got to know about scroll-snapping from Kevin Powell, but getting a shorter, dedicated video from you just feels great especially for new learners. Keep up the great content!

    • @socrates6511
      @socrates6511 ปีที่แล้ว +1

      No one asked

    • @olatunjikayode5979
      @olatunjikayode5979 ปีที่แล้ว

      @ kenneth Joshua Becaro You're a pathetic being

    • @piersStreet
      @piersStreet ปีที่แล้ว +2

      Same

    • @nickwoodward819
      @nickwoodward819 10 หลายเดือนก่อน

      @@socrates6511 pretty sure content creators ask for engagement and feedback all the time champ. that and no one needs to ask. HTH.

  • @luczztem
    @luczztem ปีที่แล้ว +2

    bro yesterday I was for hours trying to remember a video that was about scroll snapping and then today you lauch this video.... amazing

  • @mdfm28
    @mdfm28 10 หลายเดือนก่อน +1

    CSS is really powerful nowdays. I was gaonna write my snapping js code like old time but decide to google just to make sure. I glad stumble into this video, save my 2 hours writing the code. Thanks.

  • @thermicrocket4052
    @thermicrocket4052 ปีที่แล้ว +12

    I love your videos. Can you do one on actually hosting a webpage. Like what the best options are. What you use. How to push code to it / use source control.

  • @mdfri-404
    @mdfri-404 8 วันที่ผ่านมา

    so simple, I like this video. you deserve millions of subs!

  • @lausianne
    @lausianne หลายเดือนก่อน

    Very well explained, thank you. I'm happy for you that you find this incredibly easy. Maybe you have an easy solution for this: when the element is larger than the view area, depending on the scroll direction, it snaps to either the start or the end of the element (scrolling from the bottom, the element bottom will be aligned with the viewport bottom). In spite of scroll-snap-align set to start. I would expect it to always snap to start, viewport and element top aligned, and that is what I need.

  • @m0kser
    @m0kser ปีที่แล้ว +9

    Oh
    My
    God…
    It was so simple. I’ve lost entire week to develop this effect with a JS.. 😮😢

  • @JeanDidier
    @JeanDidier ปีที่แล้ว +4

    This seems like a simple thing but in a portfolio will likely grab attention to a potential recruiter

  • @rakhisingh9797
    @rakhisingh9797 ปีที่แล้ว +2

    It's just two lines of code amazing 🎉🎉

  • @Neckhawker
    @Neckhawker ปีที่แล้ว +1

    Thanks, I finally understand it.
    MDN doc isn't really clear about it.

  • @cachemoney8825
    @cachemoney8825 ปีที่แล้ว +7

    This was great CSS content, can you make a video on the opposite effect where is an "infinite" scroll or glide-like effect ?
    Thanks again!!!

  • @atleast_me
    @atleast_me 3 หลายเดือนก่อน

    You are one of the most talented developers I have seen. React, Next, and Css as well, Cool.

  • @michielarkema
    @michielarkema ปีที่แล้ว +3

    Hey Kyle, this video was really good. It's always seeing good someone put some love into CSS :)

  • @nayemalifahim6701
    @nayemalifahim6701 ปีที่แล้ว +4

    Make Responsive Product Slider using css scroll Snap.

  • @sasagasparovic9351
    @sasagasparovic9351 ปีที่แล้ว +1

    thank you, this is very usefull

  • @heavylog1c
    @heavylog1c ปีที่แล้ว +1

    I remember how I did the same with JS, it took me like a week to fix bugs. And now it’s that simple.

  • @Govjobcracker
    @Govjobcracker ปีที่แล้ว +7

    You are the #PRO in css and explanation also🎉🎉🎉🎉❤❤

    • @YuriiKratser
      @YuriiKratser ปีที่แล้ว

      Who cares about css?

    • @revelcw
      @revelcw ปีที่แล้ว +5

      @@YuriiKratser The entirety of the internet.

    • @YuriiKratser
      @YuriiKratser ปีที่แล้ว

      @@revelcw I won’t buy it.

  • @webwisesagar
    @webwisesagar ปีที่แล้ว +1

    Thanks Kyle, it seems useful.

  • @plop_dev
    @plop_dev ปีที่แล้ว +2

    i've been wondering how to do this for such a long time
    thanks

  • @andreask.291
    @andreask.291 ปีที่แล้ว +5

    Superb! 🤩
    Could U plz show how to build a side-snapping version? Would be great. 😉

  • @nidhalbettaibi488
    @nidhalbettaibi488 ปีที่แล้ว +1

    Waiting for more advanced CSS !

  • @salmanpatrick
    @salmanpatrick ปีที่แล้ว +1

    Thanks for letting us know. Vital info. Keep up the good work mate

  • @kristijanlazarev
    @kristijanlazarev ปีที่แล้ว

    Soooooo coool!! Just really wanted to see the other properties you set so I could get the same result as you. Still is amazing and simple!

  • @JuanPortalG
    @JuanPortalG ปีที่แล้ว +2

    You just made my portfolio 10 times better! Thanks, man
    Is there a way to make it scroll a little slower? I tried with "scroll-behavior: smooth" but nothing changed

    • @lukas.webdev
      @lukas.webdev ปีที่แล้ว +1

      No, for that you would need javascript..

  • @user-fm1yy5xz3p
    @user-fm1yy5xz3p ปีที่แล้ว

    Welcome back, king!

  • @FireFistMot
    @FireFistMot ปีที่แล้ว +1

    I loved this video. Keep it up

  • @rustee_nyfe
    @rustee_nyfe ปีที่แล้ว +1

    Cool and simple effect. Thanks

  • @Sameer.Trivedi
    @Sameer.Trivedi ปีที่แล้ว

    I was using some hacky javascript to achieve this until now, thanks for the vid!

  • @jtkyber
    @jtkyber ปีที่แล้ว +1

    Nice video man. Had no idea this existed

  • @godhandinfamous
    @godhandinfamous ปีที่แล้ว

    lol I thought you are gone from YT, welcome back!

    • @omomer3506
      @omomer3506 ปีที่แล้ว

      Nope he said i will decrease frequency of the number of videosni post in a week by 1 until i am done with the react course

  • @lukas.webdev
    @lukas.webdev ปีที่แล้ว +2

    I just posted a new youtube video ("Top 10 CSS Features You Should Know & Use in 2023") and obviously CSS Scroll Snap was in it... It's a really awesome CSS Feature! 👍🔥

  • @khalilbenmeziane8836
    @khalilbenmeziane8836 ปีที่แล้ว

    good to see you again kyle thank you a lot

  • @joabsonno
    @joabsonno ปีที่แล้ว

    Thanks, this video help me in my problem.

  • @CodeWithRains
    @CodeWithRains 4 หลายเดือนก่อน

    3:39 that is really nice , how can add animation delay smoothness

  • @get_video
    @get_video ปีที่แล้ว +1

    Me: I wonder how css scroll snap works?
    Web Dev Simplified: I know what you are thinking

  • @oyebunmi5413
    @oyebunmi5413 ปีที่แล้ว

    Great video 👍.
    I was looking for something like this and I wasn't getting good results in my search as I couldn't describe the feature properly. I was worried i'd have to use some package. Thanks bro.

  • @RAVISHARMA-hk5ll
    @RAVISHARMA-hk5ll ปีที่แล้ว

    wonderful explanation , congratulation, you are awesome, you are from which country ?

  • @keenoogodlike
    @keenoogodlike ปีที่แล้ว

    Nice content, that's make my day a lot easier.

  • @Modded
    @Modded 11 หลายเดือนก่อน

    Can you address the last and how it will continue scrolling past that pushing the top of the section behind the nav?

  • @amirkishk
    @amirkishk ปีที่แล้ว

    very nice video, thanks.

  • @Krotedev
    @Krotedev ปีที่แล้ว

    Perfect!

  • @MdNaimurRahmanHera
    @MdNaimurRahmanHera ปีที่แล้ว

    Wow that's a new thing I learned

  • @PROGAMER-jl7kk
    @PROGAMER-jl7kk ปีที่แล้ว

    Thank you
    I understand 😊

    • @gamermonster8909
      @gamermonster8909 ปีที่แล้ว

      😂👉 th-cam.com/video/SaVHvCsoO40/w-d-xo.html

  • @anyaforget8402
    @anyaforget8402 ปีที่แล้ว

    your videos helps me a lot 😇😇😇

  • @rameenana
    @rameenana ปีที่แล้ว

    Thanks man. This was useful.

  • @Diwakar-pd4kp
    @Diwakar-pd4kp ปีที่แล้ว

    Thankyou, it's amazing 🤯

  • @strgaltphil
    @strgaltphil ปีที่แล้ว +2

    I got a question regarding the compatibility of mobile browsers (tested on Chrome on iOS, thats beeing only a reskin of Safari). Is there a possibilty to hide the navigation bar on top and the menu bar on bottom when you got scroll snap enabled. I created a snappy full pager with scroll snap and i didn't found a way to archive this beahviour.

  • @rahulnag9582
    @rahulnag9582 ปีที่แล้ว

    Wow nice, thanks for sharing this info

  • @lucienchu9649
    @lucienchu9649 ปีที่แล้ว

    Interesting, thanks

  • @rahimco-su3sc
    @rahimco-su3sc ปีที่แล้ว

    your videos are amazing !!

  • @FromEternity
    @FromEternity ปีที่แล้ว

    Bro... you are a life saver

  • @risingrave3549
    @risingrave3549 ปีที่แล้ว

    Thanks!

  • @smith4591
    @smith4591 ปีที่แล้ว

    I never thought implementing snap scroll this easy

  • @definitelynotje
    @definitelynotje 6 วันที่ผ่านมา

    thanks bruh

  • @abdullahsoomro6238
    @abdullahsoomro6238 ปีที่แล้ว

    Thanks a lot.

  • @SlickStatus
    @SlickStatus ปีที่แล้ว

    Very helpful Thanks Brother 👍👍👍

  • @VidarrKerr
    @VidarrKerr ปีที่แล้ว

    Still need js though. That snap is brutal.

  • @sojuthomas7727
    @sojuthomas7727 ปีที่แล้ว

    Nice Kyle, always wonder how TH-cam did this on its reel

  • @rohittomar4187
    @rohittomar4187 ปีที่แล้ว

    Please make a video to style scrollbar while the dialog modal is open.

  • @CS_HimanshuVishwakarma
    @CS_HimanshuVishwakarma ปีที่แล้ว

    Can you create a video on cart in react with an easy method

  • @salvo668
    @salvo668 11 หลายเดือนก่อน

    Man... THANK YOU!

  • @giorgiberdzenishvili4115
    @giorgiberdzenishvili4115 ปีที่แล้ว

    მადლობა როგორც ყოველთვის საინტერესო და სასარგებლო. Thanks as always interesting and useful

  • @saifalkhateeb351
    @saifalkhateeb351 ปีที่แล้ว

    Thanks for the tutorial, Can I disable this for one section becaue I have a high of some section more than 100hv

  • @bloggrammer
    @bloggrammer ปีที่แล้ว +1

    If I remember correctly, web dev simplified is supposed to be on TH-cam break

    • @lukas.webdev
      @lukas.webdev ปีที่แล้ว

      No, he just produces less videos, to have more time for his side project... 😉

  • @-hero-5882
    @-hero-5882 ปีที่แล้ว

    Thank you Kyle ❤

  • @theisoj
    @theisoj ปีที่แล้ว

    Thanks Kyle as always 👍

  • @maxcohen13
    @maxcohen13 ปีที่แล้ว +2

    How did you get each section to have a different background color? There's no class or ID in the HTML tag, and you never scroll up on your CSS page for us to see how you handled it.

    • @Primoris
      @Primoris ปีที่แล้ว +2

      He left out a bit of CSS, if you just copy what he has shown in the video it doesn't even work the way its shown.

    • @lukas.webdev
      @lukas.webdev ปีที่แล้ว

      He added a different bg color for each section by adding something like: section:nth-child(1) { ... }; section:nth-child(2) { ...} ...

    • @maxcohen13
      @maxcohen13 ปีที่แล้ว +1

      @@lukas.webdev I thought that, too. But for that to work, there would at least need to be a class reference to that in the div container.

    • @lukas.webdev
      @lukas.webdev ปีที่แล้ว

      @@maxcohen13 no, I don't think so... he has multiple section html elements and with the nth-child() he targets the first section, than the second section, and so on... you don't need class names for that...
      A few days ago I posted a video where I also talk about CSS Scroll Snap... Check it out, maybe this helps ... 😉

    • @maxcohen13
      @maxcohen13 ปีที่แล้ว

      @@lukas.webdev I see what you're saying.

  • @dynowealth
    @dynowealth ปีที่แล้ว

    ty

  • @NOTHING-en2ue
    @NOTHING-en2ue ปีที่แล้ว

    Very useful thanks a lot

  • @PhilDiasPJD
    @PhilDiasPJD ปีที่แล้ว

    Simple!!! Thanks

  • @smartycode
    @smartycode ปีที่แล้ว

    what about an animation on it like after scrolling has to delay a little bit the go smooth

  • @74mada
    @74mada ปีที่แล้ว

    Thank a lot, dude.

  • @tsooooooo
    @tsooooooo ปีที่แล้ว

    Goddammit CSS is getting crazier and crazier. Thanks for the info tho

  • @etiennez0r846
    @etiennez0r846 ปีที่แล้ว

    really awesome vid ❤

  • @jam4l
    @jam4l ปีที่แล้ว

    This is great thanks

  • @user-zn7kx2hi2g
    @user-zn7kx2hi2g 2 หลายเดือนก่อน

    is there a way to snap smoothly like make it look like it scrolled smoothly or would I need some css or some js I don' t know

  • @ssk7690
    @ssk7690 ปีที่แล้ว

    amazing!

  • @munizrobson5292
    @munizrobson5292 4 หลายเดือนก่อน +1

    Where is the full css for it?

  • @tusharbudhiraja4696
    @tusharbudhiraja4696 ปีที่แล้ว

    scroll snap property does not work on the safari browser before the 14 version on mac os

  • @illegalcall
    @illegalcall ปีที่แล้ว +1

    Can you make the snap scroll a bit longer, its very fast for a desktop

  • @felipeleon6631
    @felipeleon6631 ปีที่แล้ว

    great videoo!! very useful

  • @JasonBurnettsProfile
    @JasonBurnettsProfile 7 หลายเดือนก่อน

    I couldn't help but notice that setting the scroll-padding-top and scroll-margin-top performed differently for the first element at one point in your video. At 5:57 you can see that you have not removed the setting for "scroll-padding-top" but the padding is missing. So though it worked when you first set it, you conveniently stopped before the first element in the demo until the end. Then, you scrolled all the way to the first element where the scroll-padding-top was missing (at 5:57) Is this a VSCode glitch that prevented the highlighted property from being applied correctly or is this a strange behavior that we have to account for? Thanks for the great video.

  • @Emanuel-jr2ii
    @Emanuel-jr2ii ปีที่แล้ว +1

    I find scroll snapping one of the most annoying "features" of a website. It's often not implemented corretly and as a result not favoring the customer experience.

  • @hoctapit7719
    @hoctapit7719 ปีที่แล้ว

    Can you create 1 course on react js I am very supportive

  • @sujoykrhaldar
    @sujoykrhaldar ปีที่แล้ว +1

    Is is possible to slowdown the speed or smoothness via css ?

  • @Avichai997
    @Avichai997 ปีที่แล้ว

    wow!
    one year ago i created this using a lot of js and intersectionObserver.
    it was a nightmare

  • @robertbutcher222
    @robertbutcher222 10 หลายเดือนก่อน

    If this would be scroll snap, or partially, how would you have an animation start on snap and as you scroll the animation continues, along with text popping up? What I’m thinking is let’s say a cane for the blind comes up as you scroll, but then as you scroll, turns 90 degrees and scales up. Next to it would be text and as you scroll you would see more of the cane and text, until you reach the bottom of the cane, where the page just scrolls as normal. If anyone might understand what I mean, how would something like this be done?

  • @jithinkumar7985
    @jithinkumar7985 ปีที่แล้ว +1

    Can you add a time parameter to the snap? Like is it a transition that can be speed controlled?

    • @lukas.webdev
      @lukas.webdev ปีที่แล้ว

      not with css, but with javascript... 😉

  • @sunilnune5681
    @sunilnune5681 ปีที่แล้ว

    Hi do you have any Idea of using MUI in Next Js 13.4?

  • @nayemalifahim6701
    @nayemalifahim6701 ปีที่แล้ว

    its so usefull

  • @hafizmuhammadbinasghar3108
    @hafizmuhammadbinasghar3108 5 หลายเดือนก่อน

    how i can add animations in it? i want it to be smoother

  • @shahfaisal3923
    @shahfaisal3923 ปีที่แล้ว

    Amazing

  • @a17waysJackinn
    @a17waysJackinn ปีที่แล้ว

    i wish this snapping function can make it execute once, when you go through, or make a smart detection whether or not execute depends on what you on to
    to be honest i don't like the function is frustrating. from my experience, just like you can try in instagram explore tab - usually appear that grid of posts, and when you tap again one of any of post, it takes you another page of scrolling for recommending. it's because some posts displaying such a large size, and sometimes like a, I need to get info of that post though button under it, then immediately push me back at the position tho..

  • @KIRTIPRIYAMVADATANGIRALA
    @KIRTIPRIYAMVADATANGIRALA ปีที่แล้ว

    THE BEST

  • @HaraldEngels
    @HaraldEngels ปีที่แล้ว +1

    The biggest issue I had with this technique is that I always ended up with double vertical scroll-bars when the parent container is not the element and this element has already a scroll-bar. For my use cases I couldn't find a practical solution for this issue.

  • @lucaslannes4004
    @lucaslannes4004 ปีที่แล้ว

    are you spying me? just what a needed, thx!

  • @Holy_Frijole
    @Holy_Frijole ปีที่แล้ว

    This should make jump link alignment much easier right?

  • @ayushgogna9732
    @ayushgogna9732 ปีที่แล้ว

    i am really confused if i give the same styles as html to div which is wrapping all the sections it does not work why is that ?

  • @Slaci-vl2io
    @Slaci-vl2io ปีที่แล้ว

    Which browsers have this feature?