简体   繁体   English

如何在 HTML5 中使用 CSS3 生成选取框

[英]How can I generate marquee using CSS3 in HTML5

My HTML code is我的 HTML 代码是

  <div class="container1">
   <div id="container-table"></div>
   <div id="container-tablec"></div>
   <div id="container-tableq"></div>
   <div id="container-table"></div>
   <div id="container-table"></div>
  </div>

Now, each of these DIVs generates a widget (similar to the one in stock markets).现在,这些DIV 中的每一个都会生成一个小部件(类似于股票市场中的小部件)。 I want to add all of these in a marquee effect which runs endlessly and there is no gap between the last div and the div of the next loop.我想将所有这些添加到无限运行的选取框效果中,并且最后一个 div 和下一个循环的 div 之间没有间隙。

I'm a newbie to web development.我是网络开发的新手。 I've tried using tag but, there is a gap between the ending of the last div and the beginning of the next loop.我试过使用标签,但是在最后一个 div 的结尾和下一个循环的开头之间有一个间隙。 Also, MDN suggests that I should not use it as it is an obsolete feature.此外, MDN建议我不要使用它,因为它是一个过时的功能。

I want to give it a look similar to the one in stock markets where the entire loop id endless and runs infinitely.我想给它一个类似于股票市场的外观,其中整个循环 id 无穷无尽并无限运行。

Can anyone suggest me how I can achieve this using CSS3.谁能建议我如何使用 CSS3 实现此目的。

Any help would be appreciated.任何帮助,将不胜感激。 Thanks in advance.提前致谢。

This will help you这会帮助你

 /* Sets up our marquee, and inner content */.marquee { overflow: hidden; position: relative; padding-left: 100%; /* Some browsers may require -webkit-animation */ animation: reduce 20s linear infinite; }.marquee__inner { white-space: nowrap; display: inline-block; /* Some browsers may require -webkit-animation */ animation: scroll 20s linear infinite; } /* Creates two white-to-transparent gradients at the ends of the marquee */.marquee::before, .marquee::after { z-index: 1; top: 0; left: 0; position: absolute; width: 50px; height: 100%; content: ""; display: block; }.marquee::after { left: auto; right: 0; transform: rotate(180deg); } @keyframes reduce { to { padding-left: 0; } } @keyframes scroll { to { transform: translateX( -100%); } }
 <div class="marquee"> <span class="marquee__inner">some text.</span> </div>

Fiddle Example小提琴示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM