How to Implement Stacking Cards Scrolling Effect in CSS

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ก.ย. 2024
  • In this video, you will learn how to implement a cool scrolling effect using CSS. It will be useful when you want, for example, to tell a story using a bunch of stacking cards.

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

  • @jmzalazar
    @jmzalazar ปีที่แล้ว +10

    Amazing way to teach! Congratulations! Thank you very much for this example, and again, congratulations for your simple yet complete and precise way of showing us this effect! Greetings from Argentina! 🇦🇷👍🏻🖖🏻

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

      Thank you for your kind words. You just made my day.

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

      que pasa hermano, saludo!

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

    Wow , that's a cool trick. Thanks for sharing. Waiting for more such contents.

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

      Thank you! That means a lot to me.

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

    Thank you for the video its an amazing one. Where can I get the code?

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

    Thanks bro it was very helpful

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

      @@cristianscoop7487 Thank you! 🙏

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

    Bro you're doing great work. Keep it up!

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

      Thanks a lot ❤

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

    love from Bangladesh

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

      Thank you for the kind words. You just made my day ❤

  • @ahmedghallab5342
    @ahmedghallab5342 10 วันที่ผ่านมา

    Thank you it was helpful

    • @tahazsh
      @tahazsh  9 วันที่ผ่านมา +1

      @@ahmedghallab5342 Thanks :)

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

    Amazing video, man

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

      Thanks a lot :)

  • @HaithamAli-fy8vo
    @HaithamAli-fy8vo ปีที่แล้ว

    روعة شكرا لك، هالحركة ببالي أطبقها لكني ما عرفت اسمها او وصفها

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

      فعلاً، تسمية الاشياء بتكون صعبة في بعض الاحيان. شكراً لك😄.

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

    Share your extensions

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

    "background-attachment: fixed" does the same thing in less verbose way

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

    What vscode theme do you use?

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

      It's called Night Owl: marketplace.visualstudio.com/items?itemName=sdras.night-owl

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

      @@tahazsh Thanks!

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

      @@tahazsh bro , how to implement your font in vscode, font name or extension name ?

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

      @@ZeshanMukhtar1 I'm using a font called Victor Mono (instructions included in the link): github.com/rubjo/victor-mono

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

      @@tahazsh Thanks Bro , It worked , love from pakistan

  • @TheStickofWar
    @TheStickofWar ปีที่แล้ว +17

    If you get a horizontal scrollbar, simply add max-width: 100% to your .card class. This means the element will try to do 100vw, but clamp down to 100% of the actual available space. This is a browser bug that not all browsers have solved yet, and the vertical scrollbar is considered in the 100vw calculation in some of them

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

      thank you very much

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

      Great observation 🥂

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

      thx 👑

  • @fahzz
    @fahzz ปีที่แล้ว +6

    Amazing video. Will definitely help out in my uni website project! Ty

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

      I'm very happy to hear that it's helpful to you. Thank you :)

  • @MALI-gj8sk
    @MALI-gj8sk ปีที่แล้ว +3

    I was finding the video and it's the only video i got after 30 min search. Thanks man

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

    Using classes to define a header and footer in the age of HTML 5... *shudder*

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

      I mean it still works 😂😂😂.

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

    Wow this was actually easy

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

    cool, great video mate. But, how to scale down the previous card as we scroll to next card? but the scale animation delayed for about 50px or 100px before the next card showed up?

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

      Thank you, Arie! It's actually more work than you expect. The answer to this requires a whole new video, but unfortunately I'm not planning to create it soon. But to give you a hint, you need to listen for the scroll event and based on how much of the next card is revealed apply some CSS changes to the current card. And also keep an eye on the new scroll-driven animation API, which allows you to apply animation based on scrolling using CSS only. Here's a good article explaining it: css-tricks.com/practical-use-cases-for-scroll-linked-animations-in-css-with-scroll-timelines/

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

    Much love from Jamaica! Keep up the good work!

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

      Thanks! You made my day ❤

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

    i want your coding font please

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

    Bro you should make more videos on different tricks
    Absolutely brilliant

  • @evanchan52
    @evanchan52 3 หลายเดือนก่อน +1

    Thank you! You make this so much simple than any videos i have researched!

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

      Thanks a lot! 🙏

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

    Please use a constant image instead of an always-changing random one. It’s hard to understand the effect of the img’s style

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

    Source Code??

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

    thank you so much man

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

      Thank you! I'm really glad that you liked it.

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

    *clicks* Noice...

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

    Code sample ?

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

    Thank You

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

    ty for this video , but u can use sticky position that will help u better

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

    Thanks bro really helpful

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

      Thank you!

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

    Thank you so uch u made my day I came to the solution

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

    Awesome tutorial, thank you! :)
    What VS Code extension are you using that shows you your syntax errors? It looks very nice!

    • @tahazsh
      @tahazsh  8 หลายเดือนก่อน +1

      Thank you! Yeah, it's a pretty useful plugin called Error Lens. marketplace.visualstudio.com/items?itemName=usernamehw.errorlens

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

    This was soooo Informative!! Definitely gonna use this :)

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

      I'm really happy that you liked it. Thanks!

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

    Will anchor links work with these cards?

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

    what is rimage and how to set it up?

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

      It's a code snippet in vscode. Here's an article showing you how to create one: code.visualstudio.com/docs/editor/userdefinedsnippets.
      rimage stands for "random image". It expands to Unsplash's random image API. So you can use this link to get a random image (and replace w for width and h for height) source.unsplash.com/random/wxh
      I hope this helps :)

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

      @@tahazsh Thank you so much!!

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

      @@tahazsh th-cam.com/video/TGh2NpCIDlc/w-d-xo.html step by step video

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

    Bro.. it was that simple? Great video man!

    • @tahazsh
      @tahazsh  5 หลายเดือนก่อน +1

      Thank you!

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

    Thanks for the content! You voice actually reminds me of Kevin Powell

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

      Thank you! Your comment actually made me happy because Kevin is awesome!

  • @Gil-developmentdaily
    @Gil-developmentdaily 8 หลายเดือนก่อน

    Helllo, how did you made that glass effect? great video

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

      Thanks! I think you mean reducing opacity for the background color using background: rgba(20, 50, 100, 0.8). The last value, 0.8, means that set the opacity (which is actually the alpha channel for the color) to 80%. If you set it to 0, then the background will be completely transparent, and if you set it to 1, then it will be completely opaque.

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

    make card scroll like slider

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

    Can you share the code for effect to use for NOn-Coders please

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

      Sure, here it is: gist.github.com/TahaSh/5cc4328222b77631ba034e204d228b33

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

    Bro you are genius

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

    Do cards will slide down, when we scroll up again?

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

      Yeah, it will work the same if you scroll up and down again.

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

    Hey bro that's amazing you got a new subscribe

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

      Thank you! That means a lot to me!

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

    Sorry I hope I haven't gone to the well to many times. However the fixed code works perfectly but the last card slides up to the vert top. i set the top of the cards to stop below the header and again all but the last card stops where I would expect. It's just the last card slides up under the header. I have tried many things such ad giving the last card an id and giving it an exact position. nothing works. Thank you in advance

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

      Just put a margin-top on the first card and margin-bottom on the last card of the size of the header / footer.

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

      @@tiedsergosu7715 awesome thanks. You are very kind and helpful

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

      @@hotshotrecordsadmin I’m glad I could help you out!

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

      Thank you, @TIED Sergosu for answering the question.
      @hotshotrecordsadmin Please don't hesitate to ask any other questions you have.

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

    Great tutorial, thank you! At 4:23 one thing that's worth setting up is a keybind for wrapping with emmet. In VS Code you can set it up easily (I use a corded Ctrl + w then e, for 'wrap' and 'emmet' so it's easy to remember). Then when you need to wrap some section in a new element just highlight the text and press the shortcut key (or use the terminal and search wrap with emmet). I didn't explain that very well but I thought it might be useful to some.

    • @Gukie-u6p
      @Gukie-u6p 5 หลายเดือนก่อน +1

      Pls explain easily.

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

      @@Gukie-u6p It might be easier to show in a video, maybe @tahazsh will do one? If not I'll try :)

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

    Thank you for this example, never thought about this usage if sticky position

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

      Thanks! Yeah, sticky position is a great feature in CSS.

  • @ShakilAhmmed-y2u
    @ShakilAhmmed-y2u 4 หลายเดือนก่อน

    Thanks for being so straight forward.

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

      Thank you! 🙏

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

    nice

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

    good

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

    Can I recreate this with Tailwind CSS?

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

      You should be able to. Let me know if something didn't work, and I'll take a look.

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

    This video is very usefull ! Thanks Dear !

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

      I’m really glad you liked it. Thanks!

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

    Can u plz send us your VS Code font?

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

      I'm using Victor Mono: rubjo.github.io/victor-mono/
      Note that to get the same italic style on some text, your editor theme should support that. In that video, I'm using the Night Owl theme: marketplace.visualstudio.com/items?itemName=sdras.night-owl

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

    superb !

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

    is there an easy way to keep the header and footer in place at the top and bottom?

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

      Yes, you can set their position to fixed, and they will always be sticky regardless of the current scroll position.
      .header {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      z-index: 10;
      }
      .footer {
      position: fixed;
      bottom: 0;
      left: 0;
      width: 100%;
      z-index: 10;
      }

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

      @@tahazsh Thank you

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

    straight to the point, thanks

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

      Thank you! 🙏

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

    Can you please give me the images that use in the website that you shown first in the video

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

      These images are randomly generated from Unsplash API. You can use this link source.unsplash.com/random/wxh and replace w with width and and h with height, and you will get a random image with that size every time you reload the page.
      I hope this helps :)

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

      @@tahazsh ok thanks

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

      @@tahazsh if you have saved then please share Google drive link

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

      He used an API, so the images were random, he doesn't have it

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

    I've been wanting to do something like this for a while. How do you get the "perfect" images to use? All videos just look like they nail the selection, but where would I find this myself?

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

      what do you mean by "perfect" img?

    • @al-ft1ng
      @al-ft1ng ปีที่แล้ว +2

      hes using a random image api, its basically a link that generates a new image everytime with the src of the image set to the image api

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

    Amazing. Merci 🙏

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

    will try this! thank you!❤

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

      Thank you ❤

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

    Wow! What plugins do you use?

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

      Thanks! Do you mean plugins for VSCode?

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

      He is using the built in Emmet in VSCode which allows you to define some short rules and press enter to output HTML according to the description. For example div.card*5 would create 5 div elements, with the class card

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

    nice, very interesting

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

      Glad you liked it! Thanks!

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

    Such a great video😊

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

      Thank you 😄

  • @webprogrammingtutorials-alo69
    @webprogrammingtutorials-alo69 ปีที่แล้ว

    Very useful

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

      Thanks :)

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

    Nice vídeo ❤

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

      Thanks ❤

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

    please upload more stuff like this.....your work is nice

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

      Thank you! My next video will be up very soon-and I'll get back to uploading new videos regularly.

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

    pls use background : url(.... ); for background image.

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

      Why?
      Choosing between an image tag, and loading images from css should vary.
      using the img tag is the best option, although it requires more styling.
      Imagine your image file had to change. Will you prefer editing your css file, or just passing the image source to the tag (maybe in a react application)

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

      @@coderoyalty Yeah I work like this too, I use background: url() for static images and supply to the src attribute in the image tag when things need to be dynamic

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

      @@coderoyalty
      background-image just gets the job done for me with simpler & less code.
      obviously , its a matter of preference, when there are many ways to solve the problem at hand.
      You can just apply inline-styles in your JS/React Component Files.
      If you want you can also have a custom data-attribute to set the src.
      Feel free to reply back!