用css停止选框

Stopping marquee with css

本文关键字:css      更新时间:2023-09-26

我有办法用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); }
}
相关文章:
  • 没有找到相关文章