Reputation: 11
I have around 7-8 images of Clients which I would like to display inside a <marquee>
tag.
The problem arises when the last image and the first image has a lot of gap. I would like the images to be displayed in a continuous loop.
This is the HTML
code I'm using.
<marquee>
<ul>
<li><a href="#"><img src="img/logo1.png" alt=""></a></li>
<li><a href="#"><img src="img/logo2.png" alt=""></a></li>
<li><a href="#"><img src="img/logo3.png" alt=""></a></li>
<li><a href="#"><img src="img/logo4.png" alt=""></a></li>
<li><a href="#"><img src="img/logo5.png" alt=""></a></li>
<li><a href="#"><img src="img/logo6.png" alt=""></a></li>
<li><a href="#"><img src="img/logo7.png" alt=""></a></li>
</ul>
</marquee>
I tried searching the net but couldn't find a relevant answer.
This is a sample which I found on the net but the loop works only once in my case. Sample
Upvotes: 0
Views: 6318
Reputation: 2131
EDIT
Here is one in HTML5.
Personally I would avoid using marquee.
HTML
<div id="captioned-gallery">
<figure class="slider">
<figure>
<img src="http://lorempixel.com/900/50" />
<figcaption>1</figcaption>
</figure>
<figure>
<img src="http://lorempixel.com/900/50" />
<figcaption>2</figcaption>
</figure>
<figure>
<img src="http://lorempixel.com/900/50" />
<figcaption>3</figcaption>
</figure>
<figure>
<img src="http://lorempixel.com/900/50" />
<figcaption>4</figcaption>
</figure>
<figure>
<img src="http://lorempixel.com/900/50" />
<figcaption>5</figcaption>
</figure>
</figure>
</div>
CSS
@keyframes slidy {
20% { left: 0%; }
25% { left: -100%; }
45% { left: -100%; }
50% { left: -200%; }
70% { left: -200%; }
75% { left: -300%; }
95% { left: -300%; }
100% { left: -400%; }
}
body { margin: 0; }
div#slider {
margin: auto;
width: 80%;
max-width: 900px;
border: solid 4px white;
overflow: hidden; }
div#slider figure {
position: relative;
width: 500%;
margin: 0;
left: 0;
font-size: 0;
animation: 30s slidy infinite; }
div#captioned-gallery { width: 100%; overflow: hidden; }
figure { margin: 0; }
figure.slider {
position: relative; width: 500%;
font-size: 0; animation: 30s slidy infinite; }
figure.slider figure {
width: 20%; height: auto;
display: inline-block;
position: inherit; }
@media screen and (max-width: 500px) {
figure.slider figure figcaption { font-size: 1.2rem; }
}
figure.slider figure figcaption {
position: absolute; bottom: -3.5rem;
background: rgba(0,0,0,0.3);
color: #fff; width: 100%;
font-size: 2rem; padding: .6rem;
transition: .5s bottom; }
figure.slider figure:hover figcaption { bottom: 0; }
https://jsfiddle.net/5xrbmaxo/3/
Upvotes: 1