Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

271
Visualizações
How can I make overflow text animate from left to right?

The concept is simple, when the text gets too long for the container, it would infinitely animate (scroll) from left to right, and repeat this processes after it reaches the end.

How should I go about making this?

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    </head>
    <body>
        <div class="auto-scroll">
            <p>
                This text should scroll. Lorem ipsum dolor sit amet consectetur adipisicing elit. Excepturi commodi magni quo officia error ab veniam aspernatur. Quos ducimus, hic, maxime dicta optio quidem
                nostrum sint commodi velit, ut distinctio. And return to beginning.
            </p>
        </div>

        <style>
            .auto-scroll {
                background: black;
                padding: 18px;
            }
            .auto-scroll p {
                font-family: monospace;
                font-size: 18px;
                color: white;
                margin: 0;
                white-space: nowrap;
                overflow: auto;
            }

            .auto-scroll ::-webkit-scrollbar {
                height: 10px; /* will be 0px */
            }
            .auto-scroll ::-webkit-scrollbar-track {
                background: #000;
            }
            .auto-scroll ::-webkit-scrollbar-thumb {
                background: #fff;
            }
        </style>
    </body>
</html>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You don't need javascript you can make it in css like this following code

div{
    width: 100%;
    background-color: black;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
}
p{
    display: inline-block;
    color: #FFF;
    padding-left: 100%;
    animation: move 25s linear infinite;
}
@keyframes move {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}
<div>
  <p>This text should scroll. Lorem ipsum dolor sit amet consectetur adipisicing elit. Excepturi commodi magni quo officia error ab veniam aspernatur. Quos ducimus, hic, maxime dicta optio quidem nostrum sint commodi velit, ut distinctio. And return to beginning.</p>
</div>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda