CSS slider wont Slide - html

I've got a CSS slider, But I can't get it to auto slide.
I've got 4 divs of backgrounds that I'm trying to get to auto slide as a splash page for a website.
I don't know if the issue is my data cycle or am I better of finding a JS tutorial for this?
Can anyone help, please
.content { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; z-index: 100}
body
{
background: #3B242D;
font-family: 'Raleway', sans-serif;
}
html,body{height:100%; overflow: hidden}
.cycle-slideshow{position:fixed !important;top:0;bottom:0;left:0;right:0; z-index: 0}
#keyframes slidy {
0% { left: 0%; }
20% { left: 0%; }
25% { left: -100%; }
45% { left: -100%; }
50% { left: -200%; }
70% { left: -200%; }
75% { left: -300%; }
95% { left: -300%; }
100% { left: -400%; }
}
div#slider figure {
position: relative;
width: 500%;
margin: 0;
left: 0;
text-align: left;
font-size: 0;
animation: 5s slidy infinite;
}
<!-- language: lang-html -->
<div id="slider">
<figure>
<div class="cycle-slideshow">
<div class="item"
style="background-image:url(https://thetaguk.com/site/wp-content/uploads/2017/11/splash-page-1.png)">
<div class="overlay"></div>
</div>
<div class="item"
style="background-image:url(https://thetaguk.com/site/wp-content/uploads/2017/11/splash-page-2.png)">
<div class="overlay"></div>
</div>
<div class="item"
style="background-image:url(https://thetaguk.com/site/wp-content/uploads/2017/11/splash-page-3.png)">
<div class="overlay"></div>
</div>
<div class="item"
style="background-image:url(https://thetaguk.com/site/wp-content/uploads/2017/11/splash-page-4.png)">
<div class="overlay"></div>
</div>
</div>
</figure>
</div>
I have Had abit more of a play with it and Think this is a better code, However it still does'nt work.
Have I possibly got too many DIV's going on?
I dont know if its the Div Im trying to set to slide or the Keyframes?
Thank you

Ive solved the issue.
Instead of putting background in the HTML I did it in the css and then did an animation per slide.
<div class='slider'>
<div class='slide1'><div class="text"><h2>TRUSTED ASIAN GUIDE</h2>
<h1>ASIAN WEDDING
DIRECTORY</h1>
<h2>
BRINGING YOU
OUR ADVANCED SEARCH TOOLBAR</h2></div>
</div>
<div class='slide2'><div class="text"><h2>TRUSTED ASIAN GUIDE</h2>
<h1>ASIAN WEDDING
DIRECTORY</h1>
<h2>
USE #TAGS TO FIND YOUR PERFECT
IMAGES FROM OUR SUPPLIERS</h2></div>
</div>
<div class='slide3'><div class="text"><h2>TRUSTED ASIAN GUIDE</h2>
<h1>ASIAN WEDDING
DIRECTORY</h1>
<h2>
WE’RE DOING THINGS IN A
DIFFERENT WAY</h2></div>
</div>
<div class='slide4'><div class="text"><h2>TRUSTED ASIAN GUIDE</h2>
<h1>ASIAN WEDDING
DIRECTORY</h1>
<h2>
WITH THE SUPPORT FROM THE
BIGGEST NAMES OUT THERE</h2></div>
</div>
</div>
<div class="content">
<img class="logo-img" src="https://thetaguk.com/site/wp-content/uploads/2017/11/splash-page-logo.png" alt="" >
<div class="btnContainer">
ENTER
</div>
</div>
body
{
background: #3B242D;
font-family: 'Raleway', sans-serif;
}
h1{color:#fff; border-bottom:3px solid; border-top:3px solid;}
h2{color:#fff;}
.text{height:50%; width:30%; float:right;padding-right:5%;}
.slider{position:fixed !important;top:0;bottom:0;left:0;right:0; z-index: 0; }
.slider{background-position:inherit;background-size:cover;width:100%;height:100%; z-index: 1;}
.slide1,.slide2,.slide3,.slide4,.slide5 {
position: absolute;
width: 100%;
height: 100%;
}
.slide1 {
background: url(https://thetaguk.com/site/wp-content/uploads/2017/11/splash-page-1-image.png)no-repeat center;
background-size: cover;
animation:fade 12s infinite;
-webkit-animation:fade 12s infinite;
}
.slide2 {
background: url(https://thetaguk.com/site/wp-content/uploads/2017/11/splash-page-2-image.png)no-repeat center;
background-size: cover;
animation:fade2 12s infinite;
-webkit-animation:fade2 12s infinite;
}
.slide3 {
background: url(https://thetaguk.com/site/wp-content/uploads/2017/11/splash-page-3-image.png)no-repeat center;
background-size: cover;
animation:fade3 12s infinite;
-webkit-animation:fade3 12s infinite;
}
.slide4 {
background: url(https://thetaguk.com/site/wp-content/uploads/2017/11/spashpage-4-image-1.png)no-repeat center;
background-size: cover;
animation:fade3 12s infinite;
-webkit-animation:fade3 12s infinite;
}
#keyframes fade
{
0% {opacity:1}
33.333% { opacity: 0}
66.666% { opacity: 0}
100% { opacity: 1}
}
#keyframes fade2
{
0% {opacity:0}
33.333% { opacity: 1}
66.666% { opacity: 0 }
100% { opacity: 0}
}
#keyframes fade3
{
0% {opacity:0}
33.333% { opacity: 0}
66.666% { opacity: 1}
100% { opacity: 0}
}
.btnContainer { margin-top: 20px; }
.btn {
display: inline-block;
background: #3B242D;
color: white;
padding: 10px 20px;
text-decoration: none;
}
.logo-img{
width: 320px;
}
.content { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; z-index: 100}
#media only screen and (max-width: 503px) {
.tag{ padding-left:30px; background-size:contain; }
.tag span{ font-size: 21px; }
.logo-img{
width: 160px;
}
h1 {
color: #fff;
border-bottom: 1px solid;
border-top: 1px solid;
font-size: 18px;
}
h2{color:#fff; font-size:14px;}
.text{height:50%; width:80%; }
}
#media only screen and (max-width: 768px){
.cycle-slideshow .item{
background-position:center center;
}
.tag.img-1 {
bottom: auto;
right: 10%;
top: 70px;
}
.logo-img {
width: 100px;
}
}
See the PEN here
https://codepen.io/Chazlie/pen/MOmdEX

Related

KeyFrame animation works in Chrome and Edge but not Firefox

Hello I am fairly new to styling and have seen related questions but have not been able to extract my own solution from their answers. I am hoping someone can clue me into why this carousel works as intended on Chrome and Edge but not Firefox. I have tried duplicating nearly all the CSS declarations with -moz prefix without any noticeable impact.
Less importantly, I was only able to animate the nav buttons by targeting their IDs. Originally targeting their class,n-th child had no effect,
This fiddle demonstrates the undesired behavior: https://jsfiddle.net/gharyiey/8h1tLxgo/42/
If you apply color to the "carousel_snapper" div, you can see that it actually is getting animated, but the adjacent div containing the img is not.
Any help is greatly appreciated...
CSS
#keyframes indicate {
0%, 70% {
background-color: #fff;
}
70%, 100% {
background-color: #333;
}
}
#keyframes tonext {
75% {
left: 0%;
}
95% {
left: 100%;
}
98% {
left: 100%;
}
99% {
left: 0%;
}
}
#keyframes tostart {
75% {
left: 0%;
}
95% {
left: -300%;
}
98% {
left: -300%;
}
99% {
left: 0%;
}
}
#keyframes snap {
96% {
scroll-snap-align: center;
}
97% {
scroll-snap-align: none;
}
99% {
scroll-snap-align: none;
}
100% {
scroll-snap-align: center;
}
}
* {
box-sizing: border-box;
scrollbar-color: transparent transparent; /*thumb and track color*/
scrollbar-width: 0px;
}
*::-webkit-scrollbar {
width: 0;
}
*::-webkit-scrollbar-track {
background: transparent;
}
*::-webkit-scrollbar-thumb {
background: transparent;
border: none;
}
.carousel > ol, li {
list-style: none;
margin: 0;
padding: 0;
}
.carousel {
position: relative;
filter: drop-shadow(0 0 10px #0003);
perspective: 100px;
}
.carousel__viewport {
position: relative;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
overflow-x: scroll;
scroll-behavior: smooth;
scroll-snap-type: x mandatory;
}
.carousel__slide {
position: relative;
flex: 0 0 100%;
}
.carousel__slide::before {
position: absolute;
top: 50%;
left: 50%;
transform: translate3d(-50%, -40%, 70px);
color: #fff;
font-size: 2em;
}
.carousel__snapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
scroll-snap-align: center;
/*background-color: greenyellow; <-- UNCOMMENT TO SEE ANIMATED DIV*/
}
#media (hover: hover) {
.carousel__snapper {
animation-name: snap, tonext;
animation-timing-function: ease;
animation-duration: 4100ms;
animation-iteration-count: infinite;
}
#nav1 {
animation: indicate 12300ms infinite -1000ms;
}
#nav2 {
animation: indicate 12300ms infinite 3100ms;
}
#nav3 {
animation: indicate 12300ms infinite 7200ms;
}
.carousel__slide:last-child .carousel__snapper {
animation-name: tostart, snap;
}
}
.carousel:hover .carousel__snapper,
.carousel:focus-within .carousel__snapper {
animation-play-state: paused;
}
.carousel:hover #nav1,
.carousel:focus-within #nav1 {
animation-play-state: paused;
}
.carousel:hover #nav2,
.carousel:focus-within #nav2 {
animation-play-state: paused;
}
.carousel:hover #nav3,
.carousel:focus-within #nav3 {
animation-play-state: paused;
}
.carousel__navigation {
position: absolute;
right: 0;
bottom: 0;
left: 0;
text-align: center;
}
.carousel__navigation-list,
.carousel__navigation-item {
display: inline-block;
}
.carousel__navigation-button {
display: inline-block;
width: 1.5rem;
height: 1.5rem;
background-color: #333;
background-clip: content-box;
border: 0.25rem solid transparent;
border-radius: 50%;
font-size: 0;
transition: transform 0.1s;
}
.dummy_img {
height:290px;
width:640px;
display: block;
margin-left: auto;
margin-right: auto;
}
.img_text {
text-align: center;
vertical-align: middle;
line-height: 290px;
}
HTML
<h1 style="text-align:center">PURE CSS/HTML CAROUSEL WITH ANIMATED NAV</h1>
<section class="carousel" aria-label="Gallery">
<ol class="carousel__viewport">
<li id="carousel__slide1" tabindex="0" class="carousel__slide">
<div class="carousel__snapper"></div>
<div class="dummy_img">
<h1 class="img_text">IMAGE 1</h1>
<!--<a href="">
<img src="img1.jpg" alt="alt_tag_1">
</a>-->
</div>
</li>
<li id="carousel__slide2" tabindex="0" class="carousel__slide">
<div class="carousel__snapper"></div>
<div class="dummy_img">
<h1 class="img_text">IMAGE 2</h1>
<!--<a href="">
<img src="img2.jpg" alt="alt_tag_2">
</a>-->
</div>
</li>
<li id="carousel__slide3" tabindex="0" class="carousel__slide">
<div class="carousel__snapper"></div>
<div class="dummy_img">
<h1 class="img_text">IMAGE 3</h1>
<!--<a href="">
<img src="img3.jpg" alt="alt_tag_3">
</a>-->
</div>
</li>
</ol>
<aside class="carousel__navigation">
<ol class="carousel__navigation-list">
<li class="carousel__navigation-item">
Go to slide 1
</li>
<li class="carousel__navigation-item">
Go to slide 2
</li>
<li class="carousel__navigation-item">
Go to slide 3
</li>
</ol>
</aside>
</section>

Slideshow animation bug

I have slideshow on my page, but I have small bug in animation and I can't find it.
I use slideshow according to this tutorial: https://www.youtube.com/watch?v=TzAshjkhFQw .
But I want to have only 3 slides not 4.
First 3 slides are ok, but instead of the fourth there is an empty background. I want only 3 slides and after that repeat slideshow.
/* Slider */
.slider {
display: block;
height: 100%;
width: 100%;
z-index: -1;
background-color: #1f1f1f;
overflow: hidden;
position: absolute;
top: 0px;
right: 0px;
border-bottom: 10px solid rgb(121, 0, 0);
}
.slider > * {
position: absolute;
display: block;
width: 100%;
height: 100%;
background-color: #1f1f1f;
animation: slide 12s infinite;
overflow: hidden;
}
.slide:nth-child(1) {
left: 0%;
animation-delay: -1s;
background-image: url(img/slide1.jpg);
background-size: cover;
background-position: center;
}
.slide:nth-child(2) {
left: 100%;
animation-delay: 2s;
background-image: url(img/slide2.png);
background-size: cover;
background-position: center;
}
.slide:nth-child(3) {
left: 100%;
animation-delay: 5s;
background-image: url(img/slide3.jpg);
background-size: cover;
background-position: center;
}
.slide p {
font-size: 2rem;
text-align: center;
display: inline-block;
width: 100%;
margin-top: 340px;
color: #fff;
}
#keyframes slide {
0% { left: 100%; width: 100%; opacity: 1;}
5% { left: 0%;}
25% { left: 0%;}
30% { left: -100%; width: 100%; opacity: 1;}
30.0001% { left: -100%; width: 0%; opacity: 0;}
100% { left: 100%; width: 0%; opacity: 0;}
}
<div class="slider">
<div class="slide">
<p>Slide1</p>
</div>
<div class="slide">
<p>Slide2</p>
</div>
<div class="slide">
<p>Slide3</p>
</div>
</div>
Thank you in advance for your advice!
You need to change the percentages in the animations as well as the timings on the individual slides
#keyframes slide {
0% { left: 100%; width: 100%; opacity: 1;}
6.667% { left: 0%;}
33.334% { left: 0%;}
40% { left: -100%; width: 100%; opacity: 1;}
40.0001% { left: -100%; width: 0%; opacity: 0;}
100% { left: 100%; width: 0%; opacity: 1;}
}
.slide:nth-child(2) {
animation-delay: 3s;
}
.slide:nth-child(3) {
animation-delay: 7s;
}
The animation was initially designed for 4 slides in 12 seconds, i.e. one slide every 3 seconds. If you want to change that to one slide every 4 seconds, you need to space the animations further apart (change the animation delay), and also change the animation so that the slide is visible for a longer time (multiply each percentage by 4/3).
This way of animating slides seems really inflexible however, so you might want to look at some other approach, which allows you to add or remove slides more easily.

move elements around object clockwise with CSS

given this example here
#mainPage {
width: 400px;
height: 165px;
margin: 10% auto;
}
#mainPage>p {
text-align: center;
}
.box {
width: 48px;
height: 30px;
background: red;
}
#title {
letter-spacing: 7px;
font-size: 30px;
margin-bottom: 30px;
}
#box1 {
animation: moveBox1 5s infinite;
}
#box2 {
animation: moveBox2 5s infinite;
}
#keyframes moveBox1 {
from {
/* currentPosition */
}
25% {
/* right top corner */
}
50% {
/* right bottom corner */
}
75% {
/* left bottom corner */
}
to {
/* start position */
}
}
#keyframes moveBox2 {
from {
/* currentPosition */
}
25% {
/* left bottom corner */
}
50% {
/* left top corner */
}
75% {
/* right top corner */
}
to {
/* start position */
}
}
<div id="mainPage">
<div class="box" id="box1"></div>
<p id="title">TITLE HERE</p>
<div class="box" id="box2"></div>
</div>
I want to position box2 to the right side first.
After doing so the two boxes should move around the text clockwise. I tried to start with the animation syntax but I don't know how to position them that they can move around other elements.
So box1 should have this path:
from left top
to right top
to right bottom
to left bottom
back to left top
box2 would have this path:
from right bottom
to left bottom
to left top
to right top
back to right bottom
Could someone help?
Using transform, you can achieve your solution.
#mainPage {
width: 400px;
height: 165px;
margin: 10% auto;
}
#mainPage>p {
text-align: center;
}
.box {
width: 48px;
height: 30px;
background: red;
}
#title {
letter-spacing: 7px;
font-size: 30px;
margin-bottom: 30px;
}
#box1 {
animation: moveBox1 5s infinite;
}
#box2 {
animation: moveBox2 5s infinite;
}
#keyframes moveBox1 {
from {
transform: translate(0, 0);
}
25% {
transform: translate(350px, 0);
}
50% {
transform: translate(350px, 150px);
}
75% {
transform: translate(0, 150px);
}
to {
transform: translate(0, 0);
}
}
#keyframes moveBox2 {
from {
transform: translate(350px, 0);
}
25% {
transform: translate(0, 0);
}
50% {
transform: translate(0, -150px);
}
75% {
transform: translate(350px, -150px);
}
to {
transform: translate(350px, 0);
}
}
<div id="mainPage">
<div class="box" id="box1"></div>
<p id="title">TITLE HERE</p>
<div class="box" id="box2"></div>
</div>
You could use absolute position on red box elements, and then use css animations to change its positions. This will also take box elements out of normal flow of elements.
body {
text-align: center;
}
#element{
text-align: center;
display: inline-block;
position: relative;
margin-top: 30px;
padding: 30px;
}
.box {
width: 48px;
height: 30px;
background: red;
position: absolute;
}
#title {
letter-spacing: 7px;
font-size: 30px;
margin: 0;
}
#box1 {
animation: moveBox1 5s infinite;
top: 0;
left: -48px;
}
#box2 {
animation: moveBox2 5s infinite;
bottom: 0;
right: 48px;
}
#keyframes moveBox1 {
25% {left: 100%; top: 0}
50% {left: 100%; top: calc(100% - 24px)}
75% {left: -48px; top: calc(100% - 24px)}
100% {left: -48px; top: 0}
}
#keyframes moveBox2 {
25% {right: 100%; bottom: 0;}
50% {right: 100%; bottom: calc(100% - 24px);}
75% {right: -48px; bottom: calc(100% - 24px);}
100% {right: -48px; bottom: 0;}
}
<div id="element">
<div class="box" id="box1"></div>
<p id="title">TITLE HERE</p>
<div class="box" id="box2"></div>
</div>
I'm not exactly sure what effect are you looking for but here is exampe of how you might want to position them:
#mainPage {
width: 400px;
height: 165px;
margin: 10% auto;
}
#mainPage>p {
text-align: center;
}
.box {
width: 48px;
height: 30px;
background: red;
position:absolute;
}
#title {
letter-spacing: 7px;
font-size: 30px;
margin-bottom: 30px;
}
#box1 {
animation: moveBox1 5s infinite;
}
#box2 {
animation: moveBox2 5s infinite;
}
#keyframes moveBox1 {
from {
left:170px;
top:30px;
}
25% {
left:500px;
top:30px;
}
50% {
left:500px;
top:135px;
}
75% {
left:170px;
top:135px;
}
to {
left:170px;
top:30px;
}
}
#keyframes moveBox2 {
from {
left:500px;
top:30px;
}
25% {
left:500px;
top:135px;
}
50% {
left:170px;
top:135px;
}
75% {
left:170px;
top:30px;
}
to {
left:500px;
top:30px;
}
}
<div id="mainPage">
<div class="box" id="box1"></div>
<p id="title">TITLE HERE</p>
<div class="box" id="box2"></div>
</div>
<!DOCTYPE html>
<html>
<head>
<style>
.div1 {
width: 100px;
height: 100px;
background: red;
position: relative;
-webkit-animation: myfirst 5s infinite; /* Safari 4.0 - 8.0 */
animation: myfirst 5s infinite;;
}
.div2 {
width: 100px;
height: 100px;
background: red;
position: relative;
-webkit-animation: myfirst 5s infinite; /* Safari 4.0 - 8.0 */
animation: mysecond 5s infinite;;
}
/* Safari 4.0 - 8.0 */
#-webkit-keyframes myfirst {
0% { left: 0px; top: 0px;}
25% { left: 400px; top: 0px;}
50% { left: 400px; top: 400px;}
75% { left: 0px; top: 400px;}
100% { left: 0px; top: 0px;}
}
/* Safari 4.0 - 8.0 */
#-webkit-keyframes mysecond {
0% { left: 400px; top: 200px;}
25% { left: 0px; top: 0px;}
50% { left: 0px; top: -100px;}
75% { left: 400px; top: -100px;}
100% { left: 400px; top: 200px;}
}
#keyframes myfirst {
0% { left: 0px; top: 0px;}
25% { left: 400px; top: 0px;}
50% { left: 400px; top: 400px;}
75% { left: 0px; top: 400px;}
100% { left: 0px; top: 0px;}
}
#keyframes mysecond {
0% { left: 400px; top: 200px;}
25% { left: 0px; top: 200px;}
50% { left: 0px; top: -100px;}
75% { left: 400px; top: -100px;}
100% { left: 400px; top: 200px;}
}
</style>
</head>
<body>
<div class="div1"></div>
<div class="div2"></div>
</body>

Hyperlink only partially clickable

So I have just started to learn HTML/CSS and I am trying to create a website for a magazine I'm putting together. However, when I try adding two links to two different pieces of text, one is only partially clickable and the one below is not.
I am thinking it has something to do with my wrapper or the photos I have right beside the text because when I align them more right, they're now clickable. Seems to be like something is blocking part of the word (link) to be clicked on.
I have tried making a sidebar instead but I still get the same result. I tried moving my code around for different results, but still cannot figure it out.
#wrapper {
margin: 0 auto;
width: 1140px;
}
.slider {
max-width: 457px;
height: 451px;
margin: 0 auto;
position: relative;
}
.slide1,
.slide2,
.slide3,
.slide4,
.slide5 {
position: absolute;
width: 100%;
height: 100%;
}
.slide1 {
background: url(TPWeb.jpg)no-repeat center;
background-size: cover;
animation: fade 80s infinite;
-webkit-animation: fade 20s infinite;
margin-top: 20px;
margin-left: -155px;
}
.slide2 {
background: url(DS.jpg)no-repeat center;
background-size: cover;
animation: fade2 80s infinite;
-webkit-animation: fade2 20s infinite;
margin-top: 20px;
margin-left: -155px;
}
.slide3 {
background: url(IT95Web.jpg)no-repeat center;
background-size: cover;
animation: fade3 80s infinite;
-webkit-animation: fade3 20s infinite;
margin-top: 20px;
margin-left: -155px;
}
#font-face {
font-family:
}
#keyframes fade1 {
0% {
opacity: 1
}
33.333% {
opacity: 0
}
66.666% {
opacity: 0
}
100% {
opacity: 1
}
}
#keyframes fade2 {
0% {
opacity: 0
}
33.333% {
opacity: 1
}
66.666% {
opacity: 0
}
100% {
opacity: 0
}
}
#keyframes fade3 {
0% {
opacity: 0
}
33.333% {
opacity: 0
}
66.666% {
opacity: 1
}
100% {
opacity: 0
}
}
}
.TPWeb {
margin-top: 80px;
margin-left: 50px;
}
.DFBase1 {
margin-top: 45px;
margin-left: 183px;
width: 448px;
height: 127px;
}
.ATA {
margin-right: 305px;
margin-top: -475px;
font-family:
}
.B {
margin-right: 370px;
font-family:
}
.about {
color: #000;
text-decoration: none;
}
.blog {
color: #000;
text-decoration: none;
}
<div id="wrapper">
<div class='slider'>
<div class='slide1'></div>
<div class='slide2'></div>
<div class='slide3'></div>
</div>
<img src="DFBase1.png" alt="DFBase" class=DFBase1>
<div align="right" class=ATA>
<font size="5"><em><b>about the author</b></em></font>
</div>
<div align="right" class=B>
<font size="5"><em><b>blog</b></em></font>
</div>
</div>
.slider is overlapping the links since you're using a negative margin to move the links back up on the page.
A simple fix is to give the links a z-index by assigning position: relative
.ATA, .B {
position: relative;
}
#wrapper {
margin: 0 auto;
width: 1140px;
}
.slider {
max-width: 457px;
height: 451px;
margin: 0 auto;
position: relative;
}
.slide1,
.slide2,
.slide3,
.slide4,
.slide5 {
position: absolute;
width: 100%;
height: 100%;
}
.slide1 {
background: url(TPWeb.jpg)no-repeat center;
background-size: cover;
animation: fade 80s infinite;
-webkit-animation: fade 20s infinite;
margin-top: 20px;
margin-left: -155px;
}
.slide2 {
background: url(DS.jpg)no-repeat center;
background-size: cover;
animation: fade2 80s infinite;
-webkit-animation: fade2 20s infinite;
margin-top: 20px;
margin-left: -155px;
}
.slide3 {
background: url(IT95Web.jpg)no-repeat center;
background-size: cover;
animation: fade3 80s infinite;
-webkit-animation: fade3 20s infinite;
margin-top: 20px;
margin-left: -155px;
}
#font-face {
font-family:
}
#keyframes fade1 {
0% {
opacity: 1
}
33.333% {
opacity: 0
}
66.666% {
opacity: 0
}
100% {
opacity: 1
}
}
#keyframes fade2 {
0% {
opacity: 0
}
33.333% {
opacity: 1
}
66.666% {
opacity: 0
}
100% {
opacity: 0
}
}
#keyframes fade3 {
0% {
opacity: 0
}
33.333% {
opacity: 0
}
66.666% {
opacity: 1
}
100% {
opacity: 0
}
}
}
.TPWeb {
margin-top: 80px;
margin-left: 50px;
}
.DFBase1 {
margin-top: 45px;
margin-left: 183px;
width: 448px;
height: 127px;
}
.ATA {
margin-right: 305px;
margin-top: -475px;
font-family:
}
.B {
margin-right: 370px;
font-family:
}
.about {
color: #000;
text-decoration: none;
}
.blog {
color: #000;
text-decoration: none;
}
<div id="wrapper">
<div class='slider'>
<div class='slide1'></div>
<div class='slide2'></div>
<div class='slide3'></div>
</div>
<img src="DFBase1.png" alt="DFBase" class=DFBase1>
<div align="right" class=ATA>
<font size="5"><em><b>about the author</b></em></font>
</div>
<div align="right" class=B>
<font size="5"><em><b>blog</b></em></font>
</div>
</div>

Css slider keyframe end of the loop shows blank page

I am having some issues with the slider i made using CSS. I have 2 images and i am trying to slide left. At the end of the second image, it should go first but instead shows blank slide. I think there is a problem with the keyframe percentage, not sure yet?
How do i calculate the keyframes for 2 sliding images?
<div id="captioned-gallery">
<figure class="slider">
<figure>
<img src="http://example.com/wp-content/uploads/2015/10/cyprus-nicosia-2.jpg" alt>
<figcaption>slider 1 caption</figcaption>
</figure>
<figure>
<img src="http://example.com/wp-content/uploads/2015/10/nicosia.jpg" alt>
<figcaption> slider 2 caption</figcaption>
</figure>
</figure>
</div>
and CSS
/* Frontpage Slider */
#keyframes slidy {
0% {
left: 0%;
}
50% {
left: -100%;
}
75% {
left: -200%;
}
100% {
left: -200%;
}
}
#-webkit-keyframes slidy {
0% {
left: 0%;
}
50% {
left: -100%;
}
75% {
left: -200%;
}
100% {
left: -200%;
}
}
figure {
margin: 0;
font-family: sans-serif;
font-weight: 100;
}
div#captioned-gallery {
width: 100%;
overflow: hidden;
}
figure.slider {
position: relative;
width: 200%;
font-size: 0;
animation: 25s slidy infinite;
-webkit-animation: 20s slidy infinite
}
figure.slider figure {
width: 50%;
height: auto;
display: inline-block;
position: inherit;
}
figure.slider img {
width: 100%;
height: auto;
}
figure.slider figure figcaption {
position: absolute;
top: 30%;
left: 10%;
width: 75%;
text-align: center;
line-height: 160%;
background: rgba(0, 0, 0, 0.6);
color: #fff;
font-size: 3vw;
padding: .6rem;
}
There is much wrong there, have a look here.
<div id="captioned-gallery">
<div class="slider">
http://codepen.io/damianocel/pen/PPEXgq
I could not fix the absolutely positioned figcaption though, I have no idea why, but am bit in a hurry. If someone can fox that meanwhile.
Well, this code worked for me to run 2 slides cyclic. The trick is to slow down the transition of the 2nd slide, so that when it finishes it cycles to first slide.
#keyframes slidy {
0% { left: 0%; }
50% { left: -100%; }
100% { left: -200%; }
}
#-webkit-keyframes slidy {
0% { left: 0%; }
50% { left: -100%; }
100% { left: -200%; }
}