CSS Text Animation for scrolling text [duplicate]












-1
















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










share|improve this question













marked as duplicate by Temani Afif css
Users with the  css badge can single-handedly close css questions as duplicates and reopen them as needed.

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 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
















-1
















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










share|improve this question













marked as duplicate by Temani Afif css
Users with the  css badge can single-handedly close css questions as duplicates and reopen them as needed.

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 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














-1












-1








-1









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










share|improve this question















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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 '18 at 22:44









JohnJohn

76272751




76272751




marked as duplicate by Temani Afif css
Users with the  css badge can single-handedly close css questions as duplicates and reopen them as needed.

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 css
Users with the  css badge can single-handedly close css questions as duplicates and reopen them as needed.

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 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



















  • 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

















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












1 Answer
1






active

oldest

votes


















3














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>








share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    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>








    share|improve this answer




























      3














      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>








      share|improve this answer


























        3












        3








        3







        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>








        share|improve this answer













        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>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 '18 at 23:06









        Davide CanditaDavide Candita

        1587




        1587

















            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            How to fix TextFormField cause rebuild widget in Flutter