HTMLs Tutorial

HTML Tutorial HTML Tags HTML Basic Tags HTML Attributes HTML Elements HTML Formatting HTML Text Format HTML body tag HTML samp tag HTML script Tag HTML section tag HTML select tag HTML source tag HTML span tag HTML strike tag HTML strong tag HTML style tag HTML sub tag HTML summary tag HTML sup Tag HTML svg tag HTML table tag HTML u tag HTML Headings HTML Paragraphs HTML wbr tag HTML Anchor HTML Image HTML Lists HTML Ordered List HTML Unordered List HTML Form HTML Form input HTML with CSS HTML Layouts HTML References HTML Frames HTML Links Fieldset Tag in HTML Basic HTML Tags Br Tag in HTML Free HTML Templates How to Create a Table in HTML HTML Calendar HTML Card HTML Cellspacing HTML Center Image HTML Checkbox Read-only HTML Cleaner HTML Code for a Tab HTML Comment HTML Compiler HTML Nested Forms HTML Overlay Text on the Image HTML Select Option Default HTML Snake Game HTML Subheader HTML Tab Character dd Tag in HTML How Many HTML Tags are There HTML Align Tag HTML Responsive HTML Tab Code HTML Table Alternate Row Color HTML Table Fix Column Width Contact HTML DL Tag in HTML How to Insert Image in HTML HTML Background Color HTML Dark Mode How to Convert HTML to PNG HTML Data Toggle HTML Email Template HTML Font Color HTML Font Family ID and Class in HTML HTML Tab Space HTML Tab Tag HTML Itemprop HTML Itemscope HTML Form Design HTML Input Only Numbers HTML Textarea HTML to JPG HTML to Markdown Python li Tag in HTML MDN HTML What is the Correct HTML for Making a Hyperlink? What is the Root Element of an HTML Document How to Make a Box in HTML How to Save HTML Files in Notepad How to Align Text in HTML How to Change Font Color in HTML? How to Change Font Size in HTML How to Change Image Size in HTML How to Create a HTML Page How to Create a Link in HTML File? How to Create an HTML File? HR Tag in HTML HTML Base Tag HTML Default Attribute HTML Hyperlink HTML Indent HTML Injection Payloads HTML Input Numbers Only HTML Roadmap HTML Row Height HTML Schedule HTML Space HTML Tab HTML vs HTTP HTML5 API HTML5 Video HTML Collection to Array Text Area in HTML

HTML5 Advance

HTML5 Tutorial HTML5 Tags HTML Button Tag HTML canvas Tag HTML caption Tag HTML City tag HTML Tag HTML5 SVG HTML Event Attribute HTML5 Audio HTML5 Youtube HTML5 Button Tag HTML5 Tags

Misc

How to add JavaScript to HTML How to change font in HTML How to change text color in HTML HTML Date HTML Hide Element HTML Nested Table HTML Reset Button What does HTML stand for? HTML Background Image HTML Tag Div Tag in HTML How to insert Image in HTML How to create a link with no underline in HTML How to insert spacestabs in text using HTMLCSS HTML tag HTML Code HTML Tag HTML Canvas Design a tribute page using HTML and CSS What is a Container tag Font tag in HTML Difference between HTML and DHTML Empty Tag in HTML HTML Button Link Html Line Break Img src HTML Nested List in HTML Placeholder in HTML TD in HTML HTML Space Code HTML Target Attribute HTML Tag Markup Meaning in HTML Border-Collapse in HTML HTML Onclick Online HTML Compiler Convert HTML to PDF HTML Formatter HTML5 - Web Storage HTTP – Responses Container Tag in HTML DL Tag in HTML Horizontal Rule HTML HTML Tab Text Html Table Cell Background Color HTML Table Cell Color HTML Col Width How Many HTML Tags are There Convert String to Unicode Characters in Python HTML Runner HTML Style Attribute HTML Superscript Attribute HTML tabindex Marquee Tag in HTML HTML Dynamic Form HTML side Tag HTML Pattern Attribute HTML q Tag HTML Readonly Base 64 Encoding in HTML Documents Enhancing Data Portability and Security Evo Cam Web Cam HTML Free code camp HTML CSS How to Add a JS File in HTML? How to Add Picture in HTML How to Add the Logo in HTML? How to Add Video in HTML HTML Class Attribute HTML Entities HTML Form Elements HTML Form Templates HTML Marquee Tag HTML Radio Buttons HTML Text box HTML to JSX HTML Tooltip Basic HTML Codes How to Align Image Center in HTML HTML Header Tag HTML Image Tag HTML Next Line HTML Plain Text HTML Popup Hspace in HTML HTML Interpreter HTML Maker HTML Nav Tag HTML Nested List How to create cards in HTML HTML Writer OnKeyDown in HTML Onmove in HTML Strip HTML Tags from String Style Dark Mode in HTML Automatic Image Slider in HTML CSS Base 64 Encoding in HTML Documents Enhancing Data Portability and Security Evo Cam Web Cam HTML Free code camp HTML CSS How to Add a JS File in HTML? How to Add Picture in HTML How to Add the Logo in HTML? How to Add Video in HTML HTML Class Attribute HTML Entities HTML Form Elements HTML Form Templates HTML Marquee Tag HTML Radio Buttons HTML Text box HTML to JSX HTML Tooltip Basic HTML Codes How to Align Image Center in HTML HTML Header Tag HTML Image Tag HTML Next Line HTML Section Tag hspace and vspace in Html HTML and CSS Landing Page HTML Row Span HTML Simulator How to give Space in HTML How to Display Text using HTML HTML to TEXT Converter HTML Video Poster Link CSS to HTML Nested List Example Nowrap in HTML script Tag in HTML section Tag in HTML select in HTML

Automatic Image Slider in HTML CSS

The automatic image slider is the function to display multiple images in a single div tag with the html elements and css properties. We can save the image and create pages.

Examples

The following examples show the multiple image shoulder with the css properties.

Example 1:

The example shows the multiple images slide automatically from right to left and vice versa.

<!DOCTYPE html>

<html lang = "en">

<head>

<meta charset = "UTF-8">

<meta name = "viewport" content = "width=device-width, initial-scale=1.0">

<meta http-equiv = "X-UA-Compatible" content = "ie=edge">

<title> Automatic image slider in html css </title>

<style media = "screen">

header {

max-width: 1200px;

position: absolute;

transform: translate(-50%, -50%);

top: 40%;

left: 50%;

width: 100%;

margin-left: auto;

margin-right: auto;

overflow: hidden;

}

.row {

display: flex;

overflow: hidden;

}

.imagegroup {

display: flex;

width: 100%;

}

.imagegroup img{

flex-shrink: 0;

object-fit: cover;

border: 3px solid white;

}

.imagegroup {

animation: travel 20s ease-in-out infinite;

}

@keyframes travel {

0%, 100% {

transform: translate3d(0,0,0);

}

50% {

transform: translate3d(-100%,0,0);

}

}

</style>

</head>

<body>

<h2> Automatic image slider in html css </h2>

<p> We can see the multiple images for the automatic slide in 1 second </p>

<header>

<div class = "row small">

<div class = "imagegroup" style = "animation-delay: 1s;">

<img src = "https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wm5vqieec4mjwoyzi8x1.jpg" alt = "">

<img src = "https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m7jakmy309bzbuhbjfn4.jpg" alt = "">

<img src = "https://dev-to-uploads.s3.amazonaws.com/uploads/articles/roj2muylbkhsm39450mg.jpg" alt = "">

<img src = "https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yp16bsz6ihecztrww91w.jpg" alt = "">

<img src = "https://dev-to-uploads.s3.amazonaws.com/uploads/articles/niqqsvmzx1k3n03kv5fk.jpg" alt = "">

</div>

</div>

</header>

</body>

</html>

Output

The output shows the automatic image slider in html and css.

Example 2:

The following example shows the automatic image slider with the css properties. We can set the four images for the period and show them continuously.

<!DOCTYPE html>

<html>

<head>

<meta charset = "UTF-8">

<meta name = "viewport" content = "width=device-width, initial-scale = 1.0">

<meta http-equiv = "X-UA-Compatible" content = "ie=edge">

<title> Automatic image slider in html css </title>

<style>

body {

font-size: 100%;

background: #f1f1f1;

}

/* Fallback for hidden attribute */

hidden {

display: none;

}

/** * Keyframes for autoplay */

@-webkit-keyframes autoplay {

/* position of the first slide */

0% {

left: 0;

}

/* position of the second slide */

25% {

left: -40.625rem;

} /* position of the third slide */

50% {

left: -81.25rem;

} /* position of the fourth slide */

100% {

left: -121.875rem;

}

}

@keyframes autoplay {

/* position of the first slide */

0% {

left: 0;

} /* position of the second slide */

25% {

left: -40.625rem;

} /* position of the third slide */

50% {

left: -81.25rem;

} /* position of the fourth slide */

100% {

left: -121.875rem;

}

} /** * Slider */

.slider {

position: relative; /* top margin is for purposes of demo */

margin-top: 3rem;

margin-right: auto;

margin-left: auto;

overflow: hidden;

width: 40.625rem;

height: 26.25rem;

box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);

}

.slider__list {

position: absolute;

left: 0;

width: 162.5rem;

}

.slider__slide {

float: left;

} /** * Slider control */

.slider__control {

margin-right: auto;

margin-left: auto;

width: 4.5rem;

font-family: sans-serif;

}

.slider__control label {

position: relative;

display: block;

margin-top: 2rem;

margin-bottom: 1rem;

width: 4.5rem;

height: 2rem;

font-size: 1rem;

font-weight: normal;

line-height: 1.5;

color: transparent;

background: #ddd;

border-radius: 2rem;

cursor: pointer;

-webkit-transition: left 0.15s ease-out;

transition: left 0.15s ease-out;

}

.slider__control label:before {

content: "autoplay";

position: absolute;

top: 2.5rem;

left: 0;

color: #333;

font-size: 0.95rem;

font-weight: bold;

text-transform: uppercase;

}

.slider__control label:after {

content: "";

position: absolute;

top: 0.25rem;

left: 0.25rem;

display: block;

width: 1.5rem;

height: 1.5rem;

border-radius: 2rem;

background: #fff;

-webkit-transition: left 0.15s ease-out;

transition: left 0.15s ease-out;

-webkit-transform: translate3d(0, 0, 0);

transform: translate3d(0, 0, 0);

}

.slider__switch:checked + .slider > .slider__list {

-webkit-animation-name: autoplay;

animation-name: autoplay; /* This will change the time it takes to move to the next slide */

-webkit-animation-duration: 10s;

animation-duration: 10s;

-webkit-animation-iteration-count: infinite;

animation-iteration-count: infinite;

}

.slider__switch:checked + .slider + .slider__control > label {

background: #455a64;

}

.slider__switch:checked + .slider + .slider__control > label:after {

left: 2.75rem;

}

</style>

</head>

<body>

<h2 style = "margin-top: 150px; text-align: center > Automatic image slider in html css </h2>

<p style = "text-align: center > we can see the multiple image for the automatic slide in 10 second </p>

<input

id = "sliderSwitch"

class = "slider__switch"

type = "checkbox"

name = "sliderSwitch"

hidden

/>

<div class = "slider">

<ul class = "slider__list">

<li class = "slider__slide">

<img src = "https://unsplash.it/650/420?image=924" alt = "Slide 1" />

</li>

<li class = "slider__slide">

<img src = "https://unsplash.it/650/420?image = 923" alt = "Slide 2" />

</li>

<li class = "slider__slide">

<img src = "https://unsplash.it/650/420?image=922" alt = "Slide 3" />

</li>

<li class = "slider__slide">

<img src = "https://unsplash.it/650/420?image=921" alt = "Slide 4" />

</li>

</ul>

</div>

<div class = "slider__control">

<label for = "sliderSwitch"></label>

</div>

</body>

</html>

Output:

The output shows the automatic image slider in html and css.

Example 3:

The following example shows the static and automatic image slider div or container.

<!DOCTYPE html>

<html>

<head>

<meta charset = "UTF-8">

<meta name = "viewport" content = "width=device-width, initial-scale = 1.0">

<meta http-equiv = "X-UA-Compatible" content = "ie=edge">

<title> Automatic image slider in html css </title>

<style>

header {

max-width: 1024px;

width: 100%;

margin-left: auto;

margin-right: auto;

overflow: hidden;

}

.row {

display: flex;

overflow: hidden;

}

.imagegroup {

display: flex;

width: 100%;

}

.imagegroup img{

flex-shrink: 0;

object-fit: cover;

border: 3px solid white;

}

.imagegroup {

animation: travel 20s ease-in-out infinite;

}

@keyframes travel {

0%, 100% {

transform: translate3d(0,0,0);

}

50% {

transform: translate3d(-100%,0,0);

}

}

</style>

</head>

<body>

<h2 style = "margin-top: 5px; text-align: center > Automatic image slider in html css </h2>

<p style = "text-align: center > we can see the two static image and multiple image for the automatic slide in 2 second </p>

<header>

<div class = "row large">

<div class = "imagegroup" style = "border:2px solid white">

<div class = "card"><img src = "https://picsum.photos/200?random = 1" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=2" alt = ""></div>

</div>

</div>

<div class = "row small">

<div class = "imagegroup" style = "animation-delay: 2s;">

<div class = "card"><img src = "https://picsum.photos/200?random=3" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=4" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=5" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=6" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=7" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=8" alt = ""></div>

</div>

</div>

</header>

</body>

</html>

Output:

The output shows the automatic image slider in html and css.

Example 4:

The example shows the basic slider for the multiple images in the container. We can slide multiple images within the period.

<!DOCTYPE html>

<html lang = "en">

<!-- codingflicks.com -->

<head>

<meta charset = "UTF-8">

<meta http-equiv = "X-UA-Compatible" content = "IE=edge">

<meta name = "viewport" content = "width = device-width, initial-scale = 1.0">

<title> Auto image slideshow using HTML CSS</title>

<style>

*{

padding: 0;

margin: 0;

box-sizing: border-box;

}

body {

background-color: #17374c;

}

.slider-area {

position: absolute;

transform: translate(-50%,-50%);

top: 50%;

left: 50%;

width: 90vmin;

border-radius: 10px;

border: 30px ridge #ddd;

overflow: hidden;

}

.img-area{

width: 100%;

display: flex;

animation: animate 15s linear infinite;

}

.img-area img{

max-width: 100%;

}

@keyframes animate{

0%{

transform: translateX(0);

}

25%{

transform: translateX(0);

}

30%{

transform: translateX(-30%);

}

50%{

transform: translateX(-50%);

}

55%{

transform: translateX(-55%);

}

75%{

transform: translateX(-100%);

}

80%{

transform: translateX(-120%);

}

100%{

transform: translateX(-200%);

}

}

</style>

</head>

<body>

<h2 style = "margin-top: 150px; text-align: center > Automatic image slider in html css </h2>

<p style = "text-align: center > we can see the multiple image for the automatic slide using keyframes </p>

<div class = "slider-area">

<div class = "img-area">

<div class = "card"><img src = "https://picsum.photos/200?random=5" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=6" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=7" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=8" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=3" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=4" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=1" alt = ""></div>

<div class = "card"><img src = "https://picsum.photos/200?random=2" alt = ""></div>

</div>

</div>

</body>

</html>

Output:

The output shows the automatic image slider in html and css.

Conclusion

The automatic image slider slides multiple images using the html elements, image tag, and css properties.

← Prev Next →