我有大约7-8张客户图片,我想在<marquee>
标记内显示。
当最后一张图像和第一张图像有很多间隙时,会出现问题。 我希望图像能够连续循环显示。
这是我使用的HTML
代码。
<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>
我尝试搜索网络但无法找到相关答案。
这是我在网上找到的一个示例,但在我的情况下,循环只能运行一次。 Sample
答案 0 :(得分:1)
修改
这是HTML5中的一个。
我个人会避免使用选框。
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; }