This snippet prevents a single orphan word from wrapping onto a new line in your headlines or body text. It does this by replacing the last space with a non-breaking space, keeping the last two words together for cleaner typography.
Add this code with a snippets plugin in <head>, or place it in Page CSS block or Site Settings.
* {
text-wrap: balance;
}
Add this code with a snippets plugin in <head>, or place it in Page CSS block or Site Settings.
h1, h2, h3, h4, h5, h6, p {
text-wrap: balance;
}
Add this code with a snippets plugin in <head>, or place it in Element CSS, Page CSS, or Site Settings. Use the .ou-avoid-orphan custom class on any element where you want balanced text wrapping.
.ou-avoid-orphan {
text-wrap: balance;
}
Add this code inside the Custom CSS field of an element in Elementor. The selector tag automatically targets only that specific element, so the style won’t affect others.
selector {
text-wrap: balance;
}
Some solutions only work on the live site. Always publish and test after each change, as results may not appear in the editor.