How to Implement Stacking Cards Scrolling Effect in CSS

Поделиться
HTML-код
  • Опубликовано: 3 янв 2023
  • 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.
  • НаукаНаука

Комментарии • 131

  • @MALI-gj8sk
    @MALI-gj8sk 11 месяцев назад +3

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

  • @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!

  • @evanchan52
    @evanchan52 Месяц назад

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

    • @tahazsh
      @tahazsh  Месяц назад

      Thanks a lot! 🙏

  • @hackerprime9722
    @hackerprime9722 Год назад +3

    Much love from Jamaica! Keep up the good work!

    • @tahazsh
      @tahazsh  Год назад +1

      Thanks! You made my day ❤

  • @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

  • @user-sg9it7lt4w
    @user-sg9it7lt4w 2 месяца назад

    Thanks for being so straight forward.

    • @tahazsh
      @tahazsh  2 месяца назад

      Thank you! 🙏

  • @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 :)

  • @kaustavroy6542
    @kaustavroy6542 Год назад +3

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

    • @tahazsh
      @tahazsh  Год назад

      Thank you! That means a lot to me.

  • @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.

  • @LewraAzad
    @LewraAzad Год назад +1

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

    • @tahazsh
      @tahazsh  Год назад +1

      Thanks a lot ❤

  • @debarkomukhopadhyay5008
    @debarkomukhopadhyay5008 Год назад +1

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

    • @tahazsh
      @tahazsh  Год назад

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

  • @chfaizanaslam4401
    @chfaizanaslam4401 Год назад +1

    Bro you should make more videos on different tricks
    Absolutely brilliant

  • @r15bin
    @r15bin 3 месяца назад

    straight to the point, thanks

    • @tahazsh
      @tahazsh  3 месяца назад

      Thank you! 🙏

  • @CheezePie
    @CheezePie 4 месяца назад

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

    • @tahazsh
      @tahazsh  4 месяца назад +1

      Thank you!

  • @bikrav1
    @bikrav1 Год назад

    Amazing. Merci 🙏

  • @nixonlim4715
    @nixonlim4715 Год назад

    will try this! thank you!❤

  • @vinsmokesanji7629
    @vinsmokesanji7629 5 месяцев назад

    Amazing video, man

    • @tahazsh
      @tahazsh  5 месяцев назад

      Thanks a lot :)

  • @alliedatheistalliance6776
    @alliedatheistalliance6776 6 месяцев назад

    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.

    • @user-ip1cj4ox6z
      @user-ip1cj4ox6z 4 месяца назад +1

      Pls explain easily.

    • @alliedatheistalliance6776
      @alliedatheistalliance6776 4 месяца назад

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

  • @joshua_226
    @joshua_226 Год назад +9

    Wow this was actually easy

  • @GRIIFFITHHH
    @GRIIFFITHHH Год назад +2

    thank you so much man

    • @tahazsh
      @tahazsh  Год назад

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

  • @noranmostafa1556
    @noranmostafa1556 5 месяцев назад

    Thank You

  • @chfaizanaslam4401
    @chfaizanaslam4401 Год назад

    Bro you are genius

  • @udithahashi2650
    @udithahashi2650 Год назад

    superb !

  • @nehapatil1828
    @nehapatil1828 11 месяцев назад

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

  • @ezequielmamone7906
    @ezequielmamone7906 Год назад

    Such a great video😊

  • @cristianscoop7487
    @cristianscoop7487 3 дня назад +1

    Thanks bro it was very helpful

    • @tahazsh
      @tahazsh  2 дня назад +1

      @@cristianscoop7487 Thank you! 🙏

  • @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/

  • @stadworks
    @stadworks 4 месяца назад

    Thanks bro really helpful

    • @tahazsh
      @tahazsh  4 месяца назад

      Thank you!

  • @horohovskiy
    @horohovskiy Год назад

    Will anchor links work with these cards?

  • @yousufhossain9768
    @yousufhossain9768 Год назад

    love from Bangladesh

    • @tahazsh
      @tahazsh  Год назад +1

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

  • @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!

  • @udithahashi2650
    @udithahashi2650 Год назад

    This video is very usefull ! Thanks Dear !

    • @tahazsh
      @tahazsh  Год назад

      I’m really glad you liked it. Thanks!

  • @princessrasika8350
    @princessrasika8350 2 месяца назад +1

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

  • @theuniverse8948
    @theuniverse8948 Год назад

    Hey bro that's amazing you got a new subscribe

    • @tahazsh
      @tahazsh  Год назад

      Thank you! That means a lot to me!

  • @alexthomas2667
    @alexthomas2667 6 месяцев назад

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

    • @tahazsh
      @tahazsh  6 месяцев назад +1

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

  • @z_YouCef_w
    @z_YouCef_w 10 месяцев назад

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

  • @anggerramadhan3871
    @anggerramadhan3871 Год назад

    nice, very interesting

    • @tahazsh
      @tahazsh  Год назад

      Glad you liked it! Thanks!

  • @webprogrammingtutorials-alo69
    @webprogrammingtutorials-alo69 Год назад

    Very useful

  • @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

  • @vvbhargav5854
    @vvbhargav5854 Год назад

    nice

  • @Mania_de_Gato
    @Mania_de_Gato Год назад

    Nice vídeo ❤

  • @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.

  • @asadsasoli9234
    @asadsasoli9234 Год назад

    good

  • @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.

  • @HaithamAli-fy8vo
    @HaithamAli-fy8vo Год назад

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

    • @tahazsh
      @tahazsh  Год назад

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

  • @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

  • @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.

  • @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

  • @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

  • @Icepotnoodle
    @Icepotnoodle 7 месяцев назад

    Code sample ?

  • @Gil-developmentdaily
    @Gil-developmentdaily 6 месяцев назад

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

    • @tahazsh
      @tahazsh  6 месяцев назад

      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.

  • @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.

  • @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 ruclips.net/video/TGh2NpCIDlc/видео.html step by step video

  • @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

  • @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

  • @Sri_Krisna
    @Sri_Krisna 6 месяцев назад

    i want your coding font please

  • @pranavpokale4258
    @pranavpokale4258 Год назад

    Share your extensions

  • @truthlover9448
    @truthlover9448 7 месяцев назад

    Source Code??

  • @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

  • @abhishekvishwakarma3482
    @abhishekvishwakarma3482 6 месяцев назад

    *clicks* Noice...

  • @asadsasoli9234
    @asadsasoli9234 Год назад

    make card scroll like slider

  • @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

  • @dmytrosokolovsky8959
    @dmytrosokolovsky8959 Год назад

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

  • @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!

  • @DarkxPunk
    @DarkxPunk Год назад +9

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

    • @tocj
      @tocj 5 месяцев назад

      I mean it still works 😂😂😂.