Aqui está uma versão avançada do que o OP pediu.
Às vezes, o que acontece é que nosso cliente quer que demos '-' após a quebra de palavra até o final da linha.
Gostar
AAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBB
quebrar para
AAAAAAAAAAAAAAAAAAAAAAA-
BBBBBBBBB
Portanto, há uma nova propriedade CSS, se houver suporte, geralmente compatível com os navegadores mais recentes.
.dont-break-out {
/* These are technically the same, but use both */
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
/* This is the dangerous one in WebKit, as it breaks things wherever */
word-break: break-all;
/* Instead use this non-standard one: */
word-break: break-word;
/* Adds a hyphen where the word breaks, if supported (No Blink) */
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
Estou usando este.
Espero que alguém tenha uma demanda como essa.