Effect Preview Ideas
Problem 1. How to implement infinite carousel? The problem is that when the list scrolls to the end, there will be blank space (extra space) at the bottom. How to deal with it? 2. How to let users switch back to the first item without noticing? After adding the duplicate items, control the switching timing and switch immediately when the list scrolls to the end of the last item (the beginning of the first item of the duplicate item). For example: Code <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Infinite scrolling list</title> </head> <style> .container { position: relative; background-color: #a4ffcc; /* The parent container needs to have a clear height */ height: 150px; width: 200px; margin: auto; overflow: hidden; } .container > .scroll-list { position: absolute; top: 0; left: 0; width: 100%; animation: scroll 6s linear infinite normal; } .container > .scroll-list > div { width: 100%; /* The scrollable item needs to have a specific height */ height: 30px; background-color: #1ea7ff; display: flex; justify-content: center; align-items: center; color: white; } .container > .scroll-list > div:nth-child(2n) { background-color: #18d9f8; } @keyframes scroll { 100% { /*Total height of content to scroll*/ top: -300px; } } </style> <body> <div class="container"> <div class="scroll-list"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> <div>9</div> <div>10</div> <!-- The following code is to allow the scrolling content to display one more screen (remove blank space/infinite carousel): Please calculate the number according to the height--> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> </div> </body> </html> This is the end of this article about how to implement infinite scrolling/carousel of lists with CSS3. For more relevant CSS3 list scrolling and carousel content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: How to import CSS styles into HTML external style sheets
>>: A brief summary of how to write paths when HTML files introduce external CSS files
Table of contents Preface Prepare Implementation ...
1. <select style="width:195px" name=&...
Detailed explanation and summary of the URL for d...
If you think the system is slow and want to chang...
Page turning problem scenario B and C are on the ...
When the resolution of the login interface is par...
HTML is the abbreviation of Hypertext Markup Langu...
MySQL escape Escape means the original semantics ...
Table of contents background Achieve a similar ef...
1. System installation package yum -y install mak...
Using NULL in comparison operators mysql> sele...
The large-screen digital scrolling effect comes f...
1. Create a database: create data data _name; Two...
Preface In a common business scenario, we need to...
Application nesting of unordered lists Copy code T...