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

309
Visualizações
Why does `word-wrap / overflow-wrap: break-word` break right at this point?

Both for word-wrap: break-word; and overflow-wrap: break-word; CSS properties i have a premature breaking problem at the very end like in this case. Besides, with longer strings I even witnessed this problem manifest itself in different forms like not breaking at all at the expected end of the line or self inventing a wider or narrower width for the remaining of the lines.

The question is, when you have a very long string why does overflow-wrap: break-word; "break" at certain unexpected places..?

var str = Array.from({length:65366}, _ => ~~(Math.random()*9) + 1)
               .reduce((s,c) => s + c, ""),
    blk = document.getElementById("block");

blk.textContent = str;
#block{
    margin : 0 auto;
    font-family: monospace;
    width: 90vw;
    overflow-wrap: break-word;
}
<p id="block"></p>

Note: This problem doesn't seem to exist in Firefox but in Chrome and Edge i can see it. Also while scrolling down you may notice that the right margin changes.

about 4 years ago · Juan Pablo Isaza
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