Without further ado, let’s get straight to the code * { margin: 0; padding: 0; } .container { margin:300px auto; height: 400px; width: 1146px; overflow: hidden; } /* .wrap */ .wrap { position: relative; width:10000px; left: 0px; animation: animateImg ease 5s infinite normal; } /* Image size*/ .wrap img { width: 1146px; float: left; height: 400px; display: block; } /* Animation */ @keyframes animateImg { 0% { left: 0px; } 20% { left: -0px; } 40% { left: -1146px; } 60% { left: -2292px; } 80% { left: -3438px; } 100% { left: 0px; } } The animation effect pixels are modified according to the size of your own picture <div class="container"> <div class="wrap"> <img src="images/banner1.jpg"alt="" /> <img src="images/banner2.jpg"alt="" /> <img src="images/banner3.jpg"alt="" /> <img src="images/banner4.jpg"alt="" /> </div> This is the end of this article about how to use pure CSS to achieve automatic rotation of carousel banners. For more information about how to use pure CSS to achieve automatic rotation of carousel banners, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: Implementation steps for Docker deployment of SpringBoot applications
>>: Detailed explanation of the use of Vue's new built-in components
This article shares the specific code of JavaScri...
1. Command Introduction The watch command execute...
There are many tags and elements in the HTML head ...
Create your first web page in one minute: Let'...
There is no need to say much about the difference...
Table of contents 1. Preparation Pull the redis i...
This article uses examples to illustrate the comm...
1. Install and use Docer CE This article takes Ce...
Table of contents Difference between char and var...
I wrote this blog to remember that I just install...
This article example shares the specific code of ...
Table of contents 1. Communication method between...
This article uses examples to describe the basic ...
In the previous article, I wrote a cross-table up...
Previously, the images we used were all pulled fr...