Create Responsive Automatic Slideshow With HTML And CSS


Its features:

  • It is completely responsive.

  • It can be used as an advertising banner.

  • You can use your company's ads on each of the five slides.

  • The back image has a length of 1000 pixels and a width of 474 pixels.

Try to create like yourself by following the codes below :


Step 1) Add to folder :
First make one folder and put some images that you like.
Step 2) Add to head :
<meta name="viewport" content="width=device-width, initial-scale=1">
Step 3) Add to html :
<h2>Create Responsive Automatic Slideshow With HTML And CSS</h2> <div class="slideshow-container"> <div class="mySlides fade"> <img src="001.png" style="width:100%"> </div> <div class="mySlides fade"> <img src="002.png" style="width:100%"> </div> <div class="mySlides fade"> <img src="003.png" style="width:100%"> </div> <div class="mySlides fade"> <img src="005.png" style="width:100%"> </div> <div class="mySlides fade"> <img src="006.png" style="width:100%"> </div> </div> <br>
Step 4) Add to css :
* {box-sizing: border-box;} .mySlides {display: none;} img {vertical-align: middle;} .slideshow-container { max-width: 1000px; position: relative; margin: auto; border:10px solid gray; border-radius:10px; } .text { color: #f2f2f2; font-size: 15px; padding: 8px 12px; position: absolute; bottom: 8px; width: 100%; text-align: center; } .numbertext { color: #f2f2f2; font-size: 12px; padding: 8px 12px; position: absolute; top: 0; } .active { background-color: #717171; } .fade { -webkit-animation-name: fade; -webkit-animation-duration: 1.5s; animation-name: fade; animation-duration: 1.5s; } @-webkit-keyframes fade { from {opacity: .4} to {opacity: 1} } @keyframes fade { from {opacity: .4} to {opacity: 1} } @media only screen and (max-width: 300px) { .text {font-size: 11px} }
Step 5) Add to script :
<script> var slideIndex = 0; showSlides(); function showSlides() { var i; var slides = document.getElementsByClassName("mySlides"); for (i = 0; i < slides.length; i++) { slides[i].style.display = "none"; } slideIndex++; if (slideIndex > slides.length) {slideIndex = 1} slides[slideIndex-1].style.display = "block"; setTimeout(showSlides, 2000); // Change image every 2 seconds } </script>



Thank you sir

Congratulations to you on visiting our page.

If you have any feedback, you can give advice through the "Contact Me" form.