July 24, 2026

Hyphen drama goes full nowrap

Preventing line breaks in <code> elements

Tiny website polish sparks big comment-section meltdown over readability and regex

TLDR: A site owner added a trick to keep short code snippets from splitting awkwardly across lines. Commenters instantly fought over the method, with critics calling it fragile, unnecessary, and potentially annoying for phone users who may have to scroll sideways.

A website owner made a very small design tweak—stopping short bits of computer text from breaking awkwardly across lines—and the internet immediately turned it into a full-on comments brawl. The idea was simple: if a short code snippet like a command or label contains a space or hyphen, keep it together so it doesn’t get split in ugly ways. It’s the kind of tiny polish nobody notices until they do, and then suddenly everyone has an opinion.

And wow, did they. One camp basically stormed in waving a giant "don’t use regex on HTML" banner, turning the discussion into a classic nerd flame-war. Another group asked the obvious question: why not just make all code stay on one line and skip the complicated extra step? Then came the practical crowd with the cold splash of reality: on phones and narrow screens, forcing code to stay together can mean annoying sideways scrolling. In other words, the feature meant to make reading smoother might make it worse for some people.

That clash is the real story here: beauty vs simplicity vs usability. The original post is about tiny typographic niceness, but the comments read like a reality show reunion special. One person is yelling that the method is forbidden, another is calling it overengineered, and another is speaking for every mobile reader who has ever rage-scrolled sideways. It’s a reminder that online, even a hyphen can start drama.

Key Points

  • The author previously used non-breaking spaces and hyphens in body text to prevent awkward browser-inserted line breaks.
  • The article extends this approach to inline `<code>` elements after the author observed unhelpful wrapping in a recent post.
  • Examples cited include code fragments like `(?-u:…)` and the flag `--multiline` being split at line breaks.
  • The author chose not to replace code hyphens with non-breaking hyphens because copied code could change meaning.
  • A Python regex-based check adds a `nowrap` class to short `<code>` snippets containing spaces or hyphens, and CSS `text-wrap: nowrap;` prevents wrapping.

Hottest takes

"You can't parse [X]HTML with regex" — danlitt
"Why even bother with the CSS class?" — pwdisswordfishq
"much harder to read on narrow-width screens" — pimlottc
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.