Reputation: 23
I am trying to add a marquee effect with CSS3 animation in Wordpress as it doesn't support the <marquee>
tag. I would like to get rid of the white space in between each loop. I tried using nowrap but it doesn't work.
@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>
Link here: http://www.houseofbase.fr/preview/wordpress/comingsoon/
Upvotes: 2
Views: 4983
Reputation: 1
.marquee {
width: 100%;
height: 80px;
margin: 0 auto;
overflow: hidden;
display: inline-grid;
}
Upvotes: 0
Reputation: 3648
Something like this do what you want.
.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>
Upvotes: 1
Reputation: 3435
It is not a good idea to using text-indent
for transform. Use this instead of your animation:
@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>
Upvotes: 1
Reputation: 41
Don't know if i understand but try use margin-left negative like:
.marquee a{ margin-left: -50%; }
Upvotes: 0