
This snippet fixes awkward line breaks, especially the annoying “orphan” word problem where one tiny word ends up alone on a new line looking lost and unloved.
balance is used for headings because titles should look visually even, not like one long line with a sad little word underneath it.
For example, instead of a heading breaking like:
“Design your future
today”
it tries to balance it into something cleaner like:
“Design your
future today”
pretty is used for paragraphs and lists because it focuses on reading comfort, keeping text from breaking in strange places or creating ugly spacing inside sentences.
Copy & paste the scripts before the </body> tag of your project. If you added them before for another setup, skip this step.
Place the code in an HTML widget or add it through Elementor → Custom Code (before the closing </body> tag) either globally or only on selected pages.
Paste the code through the page or site settings, or add it via Elementor → Custom Code (before </body>) for broader use.
/* Balanced wrapping for headings */
h1, h2, h3, h4, h5, h6 {
text-wrap: balance;
}
/* Smooth wrapping for body text */
p, li, blockquote {
text-wrap: pretty;
}Paste the script through Elementor → Custom Code (set to load after </body>) for site-wide or page-specific loading.
Place the PHP snippet inside your theme’s functions.php or using any code snippet to enable logic.
Some solutions only work on the live site. Always publish and test after each change, as results may not appear in the editor.