我正在尝试在 Wordpress 中使用 CSS3 动画添加选取框效果,因为它不支持 <marquee>
标签。我想摆脱每个循环之间的空白。我尝试使用 nowrap,但它不起作用。
@keyframes marquee {
0% {
text-indent: 430px
}
100% {
text-indent: -485px
}
}
@-webkit-keyframes marquee {
0% {
text-indent: 430px
}
100% {
text-indent: -485px
}
}
.marquee {
font-size: 50px;
overflow: hidden;
white-space: nowrap;
animation: marquee 12s linear infinite;
-webkit-animation: marquee 12s linear infinite;
}
.marquee:hover {
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
<p class="marquee">
<a href="#">
SOON SOON SOON SOON SOON SOON SOON </a></p>
此处链接:http://www.houseofbase.fr/preview/wordpress/comingsoon/
最佳答案
使用 text-indent
进行转换不是一个好主意。用这个代替你的动画:
@keyframes marquee {
0% {
transform: translateX(100vw);
}
100% {
transform: translateX(-100vw);
}
}
@-webkit-keyframes marquee {
0% {
transform: translateX(100vw);
}
100% {
transform: translateX(-100vw);
}
}
@keyframes marquee {
0% {
transform: translateX(100vw);
}
100% {
transform: translateX(-100vw);
}
}
@-webkit-keyframes marquee {
0% {
transform: translateX(100vw);
}
100% {
transform: translateX(-100vw);
}
}
.marquee {
font-size: 50px;
overflow: hidden;
white-space: nowrap;
animation: marquee 12s linear infinite;
-webkit-animation: marquee 12s linear infinite;
}
.marquee:hover {
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
<p class="marquee">
<a href="#">
SOON SOON SOON SOON SOON SOON SOON </a></p>
关于css - 删除 CSS 选框中的空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42724663/