我正在尝试在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/
答案 0 :(得分:1)
像这样做你想做的事。
.marquee {
width: 100%;
height: 80px;
margin: 0 auto;
overflow: hidden;
white-space: nowrap;
}
.marquee-content {
display: inline-block;
margin-top: 5px;
animation: marquee 10s linear infinite;
}
.item-collection-1 {
position: relative;
left: 0%;
animation: swap 10s linear infinite;
}
@keyframes swap {
0%, 50% {
left: 0%;
}
50.01%,
100% {
left: 100%;
}
}
.marquee-content:hover {
animation-play-state: paused
}
.item1 {
display: inline-block;
height: auto;
width: 500px;
background: cyan;
vertical-align: top;
margin-left: 15px;
}
.item2 {
display: inline-block;
height: auto;
width: 500px;
background: magenta;
vertical-align: top;
margin-left: 15px;
}
/* Transition */
@keyframes marquee {
0% {
transform: translateX(0)
}
100% {
transform: translateX(-100%)
}
}
<div class="marquee">
<div class="marquee-content">
<span class="item-collection-1">
<span class="item1"><a href="http://www.google.com">soon soon soon soon soon soon soon soon soon soon soon soon soon soon</a></span>
<span class="item1"><a href="http://www.google.com">soon soon soon soon soon soon soon soon soon soon soon soon soon soon</a></span>
</span>
<span class="item-collection-2">
<span class="item2"><a href="http://www.google.com">soon soon soon soon soon soon soon soon soon soon soon soon soon soon</a></span>
<span class="item2"><a href="http://www.google.com">soon soon soon soon soon soon soon soon soon soon soon soon soon soon</a></span>
</span>
</div>
<div>
答案 1 :(得分:0)
不知道我是否理解,但尝试使用 margin-left 否定,如:
.marquee a{ margin-left: -50%; }
答案 2 :(得分:0)
使用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;
}
&#13;
<p class="marquee">
<a href="#">
SOON SOON SOON SOON SOON SOON SOON </a></p>
&#13;