Normal view

No Break – a saga...

10 August 2026 at 10:04

I have been using <span class="nobr">...</span> for years to keep important phrases together in headlines and prevent awkward line breaks/widows across responsive layouts. It works, but when scanning HTML it can be interruptive to reading in code view. I am switching to the shorthand of <nbr>...</nbr> and converting it to a proper HTML output element with a WordPress filter before rendering. The filters hook into the_content and the_title so both article text and post headlines can use the same syntax, while CSS simply applies white-space: nowrap. It is a small change, but improves the readability when updating content. I have been toying with building an intelligent plugin that can preflight copy to tag phrases / other rule based grouping, and maybe use a headless HTML rendered to see how copy breaks on various device widths.

submitted by /u/Haute_Evolutionary
[link] [comments]
❌