我有大约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
发布于 2015-07-22 20:05:11
编辑
这里有一个在HTML5中。
就我个人而言,我会避免使用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://stackoverflow.com/questions/31561800
复制相似问题