CSS Text Animation for scrolling text [duplicate]
This question already has an answer here:
left-right movement.. css only very generic
1 answer
I think I am half way there, but I need some CSS3 or jQuery help to complete this scrolling text.
I have a div, I need the text to scroll from left to right, then when hitting the end of the div scroll right to left again and so on.
I currently have it going from left to right, however it seems to run outside of the div and I don't know how to get it going back right to left, and so on.
Here is a DEMO:
http://jsfiddle.net/vdb3ofmL/1118/
#movetxt {
-webkit-animation: moving 5s infinite;
animation: moving 5s infinite;
}
@-webkit-keyframes moving {
from {-webkit-transform: translateX(0px);}
to {-webkit-transform: translateX(200px);}
}
@keyframes moving {
from {transform: translateX(0px);}
to {transform: translateX(200px);}
}
Thanks
jquery html css css3
marked as duplicate by Temani Afif
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 23:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
left-right movement.. css only very generic
1 answer
I think I am half way there, but I need some CSS3 or jQuery help to complete this scrolling text.
I have a div, I need the text to scroll from left to right, then when hitting the end of the div scroll right to left again and so on.
I currently have it going from left to right, however it seems to run outside of the div and I don't know how to get it going back right to left, and so on.
Here is a DEMO:
http://jsfiddle.net/vdb3ofmL/1118/
#movetxt {
-webkit-animation: moving 5s infinite;
animation: moving 5s infinite;
}
@-webkit-keyframes moving {
from {-webkit-transform: translateX(0px);}
to {-webkit-transform: translateX(200px);}
}
@keyframes moving {
from {transform: translateX(0px);}
to {transform: translateX(200px);}
}
Thanks
jquery html css css3
marked as duplicate by Temani Afif
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 23:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Try to useposition
in CSS3. As you can see, text point is in middle, not at right side.
– SilvioCro
Nov 21 '18 at 22:52
Do you want this responsive, or will the container element always be 300px?
– ptts
Nov 21 '18 at 22:59
add a comment |
This question already has an answer here:
left-right movement.. css only very generic
1 answer
I think I am half way there, but I need some CSS3 or jQuery help to complete this scrolling text.
I have a div, I need the text to scroll from left to right, then when hitting the end of the div scroll right to left again and so on.
I currently have it going from left to right, however it seems to run outside of the div and I don't know how to get it going back right to left, and so on.
Here is a DEMO:
http://jsfiddle.net/vdb3ofmL/1118/
#movetxt {
-webkit-animation: moving 5s infinite;
animation: moving 5s infinite;
}
@-webkit-keyframes moving {
from {-webkit-transform: translateX(0px);}
to {-webkit-transform: translateX(200px);}
}
@keyframes moving {
from {transform: translateX(0px);}
to {transform: translateX(200px);}
}
Thanks
jquery html css css3
This question already has an answer here:
left-right movement.. css only very generic
1 answer
I think I am half way there, but I need some CSS3 or jQuery help to complete this scrolling text.
I have a div, I need the text to scroll from left to right, then when hitting the end of the div scroll right to left again and so on.
I currently have it going from left to right, however it seems to run outside of the div and I don't know how to get it going back right to left, and so on.
Here is a DEMO:
http://jsfiddle.net/vdb3ofmL/1118/
#movetxt {
-webkit-animation: moving 5s infinite;
animation: moving 5s infinite;
}
@-webkit-keyframes moving {
from {-webkit-transform: translateX(0px);}
to {-webkit-transform: translateX(200px);}
}
@keyframes moving {
from {transform: translateX(0px);}
to {transform: translateX(200px);}
}
Thanks
This question already has an answer here:
left-right movement.. css only very generic
1 answer
jquery html css css3
jquery html css css3
asked Nov 21 '18 at 22:44
JohnJohn
76272751
76272751
marked as duplicate by Temani Afif
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 23:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Temani Afif
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 23:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Try to useposition
in CSS3. As you can see, text point is in middle, not at right side.
– SilvioCro
Nov 21 '18 at 22:52
Do you want this responsive, or will the container element always be 300px?
– ptts
Nov 21 '18 at 22:59
add a comment |
Try to useposition
in CSS3. As you can see, text point is in middle, not at right side.
– SilvioCro
Nov 21 '18 at 22:52
Do you want this responsive, or will the container element always be 300px?
– ptts
Nov 21 '18 at 22:59
Try to use
position
in CSS3. As you can see, text point is in middle, not at right side.– SilvioCro
Nov 21 '18 at 22:52
Try to use
position
in CSS3. As you can see, text point is in middle, not at right side.– SilvioCro
Nov 21 '18 at 22:52
Do you want this responsive, or will the container element always be 300px?
– ptts
Nov 21 '18 at 22:59
Do you want this responsive, or will the container element always be 300px?
– ptts
Nov 21 '18 at 22:59
add a comment |
1 Answer
1
active
oldest
votes
I think the solution is to use right
and translateX
in %
and with absolute
positioning.
Adding alternate
to animation
plays the animation backwards.
.container {
margin: 0 auto;
width: 300px;
border: 1px solid red;
position: relative;
overflow: hidden;
height: 1em;
}
#movetxt {
animation: moving 2s infinite linear alternate;
position: absolute;
white-space: nowrap;
}
@keyframes moving {
from {
transform: translateX(100%);
right: 100%;
}
to {
transform: translateX(0%);
right: 0%;
}
}
<div class="container">
<div id="movetxt">left to right, right to left</div>
</div>
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think the solution is to use right
and translateX
in %
and with absolute
positioning.
Adding alternate
to animation
plays the animation backwards.
.container {
margin: 0 auto;
width: 300px;
border: 1px solid red;
position: relative;
overflow: hidden;
height: 1em;
}
#movetxt {
animation: moving 2s infinite linear alternate;
position: absolute;
white-space: nowrap;
}
@keyframes moving {
from {
transform: translateX(100%);
right: 100%;
}
to {
transform: translateX(0%);
right: 0%;
}
}
<div class="container">
<div id="movetxt">left to right, right to left</div>
</div>
add a comment |
I think the solution is to use right
and translateX
in %
and with absolute
positioning.
Adding alternate
to animation
plays the animation backwards.
.container {
margin: 0 auto;
width: 300px;
border: 1px solid red;
position: relative;
overflow: hidden;
height: 1em;
}
#movetxt {
animation: moving 2s infinite linear alternate;
position: absolute;
white-space: nowrap;
}
@keyframes moving {
from {
transform: translateX(100%);
right: 100%;
}
to {
transform: translateX(0%);
right: 0%;
}
}
<div class="container">
<div id="movetxt">left to right, right to left</div>
</div>
add a comment |
I think the solution is to use right
and translateX
in %
and with absolute
positioning.
Adding alternate
to animation
plays the animation backwards.
.container {
margin: 0 auto;
width: 300px;
border: 1px solid red;
position: relative;
overflow: hidden;
height: 1em;
}
#movetxt {
animation: moving 2s infinite linear alternate;
position: absolute;
white-space: nowrap;
}
@keyframes moving {
from {
transform: translateX(100%);
right: 100%;
}
to {
transform: translateX(0%);
right: 0%;
}
}
<div class="container">
<div id="movetxt">left to right, right to left</div>
</div>
I think the solution is to use right
and translateX
in %
and with absolute
positioning.
Adding alternate
to animation
plays the animation backwards.
.container {
margin: 0 auto;
width: 300px;
border: 1px solid red;
position: relative;
overflow: hidden;
height: 1em;
}
#movetxt {
animation: moving 2s infinite linear alternate;
position: absolute;
white-space: nowrap;
}
@keyframes moving {
from {
transform: translateX(100%);
right: 100%;
}
to {
transform: translateX(0%);
right: 0%;
}
}
<div class="container">
<div id="movetxt">left to right, right to left</div>
</div>
.container {
margin: 0 auto;
width: 300px;
border: 1px solid red;
position: relative;
overflow: hidden;
height: 1em;
}
#movetxt {
animation: moving 2s infinite linear alternate;
position: absolute;
white-space: nowrap;
}
@keyframes moving {
from {
transform: translateX(100%);
right: 100%;
}
to {
transform: translateX(0%);
right: 0%;
}
}
<div class="container">
<div id="movetxt">left to right, right to left</div>
</div>
.container {
margin: 0 auto;
width: 300px;
border: 1px solid red;
position: relative;
overflow: hidden;
height: 1em;
}
#movetxt {
animation: moving 2s infinite linear alternate;
position: absolute;
white-space: nowrap;
}
@keyframes moving {
from {
transform: translateX(100%);
right: 100%;
}
to {
transform: translateX(0%);
right: 0%;
}
}
<div class="container">
<div id="movetxt">left to right, right to left</div>
</div>
answered Nov 21 '18 at 23:06


Davide CanditaDavide Candita
1587
1587
add a comment |
add a comment |
Try to use
position
in CSS3. As you can see, text point is in middle, not at right side.– SilvioCro
Nov 21 '18 at 22:52
Do you want this responsive, or will the container element always be 300px?
– ptts
Nov 21 '18 at 22:59