Build an Infinite Scroll Animation Effect Using Only CSS

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ก.ค. 2024
  • This step-by-step CSS tutorial teaches how to design and implement an infinite CSS scroll animation effect using only HTML and CSS. In this video, we'll cover everything you need to know to create a seamless scrolling effect for stock symbols, prices, and changes, without relying on JavaScript. Learn how to craft an infinite stock ticker, logo carousel or news ticker that seamlessly scrolls through content, adding a touch of flair to your website.
    Discover the power of CSS marquee animations as we demonstrate how to achieve an infinite scrolling effect without the need for JavaScript. From creating an infinite autoplay slider to crafting a horizontal stock ticker, our tutorial covers a range of techniques to elevate your web design skills. Watch now and level up your website with a dynamic and engaging scroll animation.
    Like, share, and subscribe to our channel for exciting web development tutorials.
    Live Demo: codepen.io/optimisticweb/pen/...
    Related Topics
    -----------------------------------------------------
    - Infinite Scrolling Animation
    - Infinite Marquee Animation With Pure CSS
    - How To Make An Infinite Autoplay Slider
    - Pure CSS Infinite News Ticker Scrolling Animation Effects
    - Creating an infinite logo carousel with pure CSS
    - How to Create a Horizontal News Ticker with CSS Only
    Chapters
    -----------------------------------------------------
    00:00 Intro
    00:34 The deprecated marquee tag
    00:55 HTML for the infinite scroll animation
    01:31 CSS for the infinite stock ticker
    04:39 Fix scroll animation for a smoother effect
    Subscribe and never miss a beat
    -----------------------------------------------------
    🔔 Subscribe for more videos like this: www.youtube.com/@OptimisticWe...
    Learn at your own pace
    -----------------------------------------------------
    - Learn HTML - • HTML
    - Learn CSS - • CSS
    - Learn JavaScript - • JavaScript
    Connect, share, and grow
    -----------------------------------------------------
    - TH-cam: / @optimisticweb
    - X (Twitter): / optimisticweb
    - Instagram: / optimisticweb
    - Facebook: / optimisticweb
    - CodePen: codepen.io/optimisticweb
    #css #infinitescroll #cssscrolling #cssmarquee #cssanimation #webdesign #cssmagic #csstutorial #html #cssforbeginners #webdevtutorial #learncss #learnhtml #optimisticweb

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

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

    Try and experiment with the code at the link provided in the description.

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

    Awesome and very well presented tutorial. Thank you for sharing, and for providing the codepen demo.

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

      You're welcome, glad you enjoyed it.

  • @biggand8520
    @biggand8520 4 หลายเดือนก่อน +2

    Cool, as always, especially I like that little thing with animation pause when hovering over

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

      Thank you! That animation pause not only adds a nice touch but also enhances the overall user experience.

  • @SharunKumar
    @SharunKumar 4 หลายเดือนก่อน +28

    RIP

    • @OptimisticWeb
      @OptimisticWeb  4 หลายเดือนก่อน +3

      Indeed, had its charm.

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

      It still works though...?​@@OptimisticWeb

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

      Yes, even though it is deprecated, it still works in many browsers.

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

      Not recommended as it could be removed anytime​@@borstenpinsel

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

      Has browsers removed any deprecated tags since 00’s?

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

    Thank you this, very clean code !🖥

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

      Thank you! Glad you liked it.

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

    Bloody clever!

  • @thenightwolf224
    @thenightwolf224 4 หลายเดือนก่อน +2

    Your Channel Is AMAZING KEEP GOING BUDDY

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

      Thank you! Your support means a lot.

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

    Thanks Man 🤞🤞

  • @philipbailey8479
    @philipbailey8479 26 วันที่ผ่านมา +1

    Thank you, this is an amazing tutorial. I'm trying to use this for my website menu and I would like alternating rows to be moving in reverse. How can I achieve that? Currently I've got rows 2 and 4 scrolling the opposite way but they're leaving a big gap behind them and then it just resets.

    • @OptimisticWeb
      @OptimisticWeb  25 วันที่ผ่านมา

      Thank you! I'm glad you found the tutorial helpful. If you can share your CodePen, I can take a look and help debug the issue. Just a heads-up, adding multiple animations like this on a page can negatively affect performance and user experience, so it's worth considering the overall impact.

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

    I love you was just what I needed

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

      Glad to hear I could be of some help.

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

    web technology is really ineffcient. great tutorial btw.

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

    Nice approach

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

    This is a very useful tip.
    But I have a question about it.
    As I understood, we need a twin which has no meaning for the html document but required only for this fluid scroll effect right?
    I think this kind of approach is not a proper way of web accessibility, especially for people who rely on screen readers.
    What about adding some Javascript?
    I think adding some margin attribute for next marquee queue .. something like that will make it perfect.
    Your tips and creative way of approach is always appreciated. And I love it. Thanks.

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

      That's why, at 05:05, I talked about adding an aria-hidden attribute. It helps remove duplicated elements from the accessibility tree, so screen readers don't get mixed up. Also, when you use JS for carousels, it often creates duplicate elements on the fly. The main point of this video was to show how to make an endless loop using only CSS. Hope this helps.

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

      @@OptimisticWeb
      Aha!!!
      I missed the area-hidden part. Sorry that I missed it.
      Your works are great. Just keep on.

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

      No problem, and thanks for your support.

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

    👏👏👏👏👏

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

    No one ever really explains why the marquee tag is "deprecated" and it just keeps being supported by most browsers if not all. The only real issue with marquee is simply that there's no way to avoid the empty space at the ends of each cycle. Maybe someday we'll get something like this: Some Content

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

      To the best of my knowledge, the marquee tag was never officially included in W3C specifications. Though it still works in many browsers, it seems there hasn't been much effort to enhance or standardize it.

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

      The logic is html is suppose to show what the content is not to show animations.

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

      @@JamilKhan-hk1wl A valid point...

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

    I will do this and add an api for stocks

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

      That sounds like a plan! Please share once it's done.

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

    Srsly, Someone should create a petition for bringing marquee back 2 life
    (Yes, I know it still works, but please remove that deprecated label and make improvement on it)

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

      Removing the deprecated label and improving it further would be interesting. Who knows, maybe someday..!

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

    It's good in general, but if you are going to use it in real progect it would not be okay. Due to the fact that it is immediately scroll back when first ul finished, and it has bad user experience, because it stops on the middle of the second ul at the same time.

    • @user-iw3kq3mn8j
      @user-iw3kq3mn8j 4 หลายเดือนก่อน

      Other words animation is not great in details

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

      Thanks for your input. Regarding user experience, we've already got the aria-hidden attribute set up for screen readers. Plus, when the first UL replaces its copy, their positions and visual attributes are exactly the same so that no human eye can catch it. Also, there's a hover effect to let users pause the animation when they want to interact.
      But, of course, there are several ways to achieve the same effect including the use of JavaScript. The aim of this video is to demonstrate a CSS-only approach to creating an infinite loop.

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

      in a real project you would pull however many stocks you want from a database or something and have javascript to put the ul lists in twice.

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

      Absolutely! JS-based carousels often clone elements at runtime.

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

    Why did they get rid of the marquee tag? Idiotic move.

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

      From what I understand, the marquee tag had limitations and didn't align well with accessibility and modern design principles. However, it still works in many browsers.

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

      I don't buy that argument. In the end I built an infinite scroller using vanilla js and css key frames which can be turned off on mobile devices.

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

      It could have been improved if there were any issues with the marquee tag. Not sure why no one went down that path. Anyways, there are alternatives in the market, with or without JS.

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

    marquee is easiest

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

      Indeed, but deprecated.

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

    sorry. I noped out on unnecessarily duplicating the html.

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

      No worries! Each solution has its pros and cons. Also, many JS-based carousels duplicate elements dynamically. That's precisely why we included the aria-hidden attribute, to ensure screen readers stay on track. Appreciate your feedback!

  • @patriotir
    @patriotir 8 วันที่ผ่านมา +1

    So much unnecessary info. Go straight to the point which is infinite scroll animation

    • @OptimisticWeb
      @OptimisticWeb  8 วันที่ผ่านมา

      Thank you for your feedback! I appreciate your input and always strive to improve. These videos aim to include information that benefits developers of all levels, including beginners, so sometimes we need to set the foundation. Please let me know which parts you found unnecessary and where I could be more concise.