繁体   English   中英

用CSS停止字幕

[英]Stopping marquee with css

有什么办法可以阻止CSS marquee吗? 出于安全原因,我无法使用javascript

如何使用CSS做到这一点?

编辑:我想在鼠标悬停时停止它,否则启动它。

marquee:hover
{
  -moz-binding: none;
}

尝试这个。 但是-moz-binding的目的是不同的。 但这有效。

请参阅此以获取Webkit参考:SO

的HTML

<p class="microsoft marquee"><span>Windows 8 and ...</span></p>

的CSS

.marquee {
  width: 450px;
  margin: 0 auto;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

.marquee span {
  display: inline-block;
  padding-left: 100%;  /* show the marquee just outside the paragraph */
  animation: marquee 15s linear infinite;
}

.marquee span:hover {
  animation-play-state: paused
}

/* Make it move */
@keyframes marquee {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(-100%, 0); }
}

暂无
暂无

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

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