Preventing line breaks in <code> elements
surprisetalk
14 points
20 comments
July 24, 2026
Related Discussions
Found 5 related stories in 1202.8ms across 14,736 title embeddings via pgvector HNSW
- Out with the JavaScript, in with the HTML Brajeshwar · 34 pts · May 11, 2026 · 46% similar
- HTML Lists speckx · 310 pts · May 16, 2026 · 46% similar
- The future of text layout is not CSS skeptrune · 12 pts · March 28, 2026 · 45% similar
- No Semicolons Needed karakoram · 42 pts · March 21, 2026 · 45% similar
- The unreasonable effectiveness of simple HTML (2021) luispa · 70 pts · June 11, 2026 · 45% similar
Discussion Highlights (4 comments)
danlitt
You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML.
pwdisswordfishq
Why even bother with the CSS class? Just apply text-wrap: nowrap; to all <code> elements and dispense with the fragile regex parsing.
pimlottc
Unfortunately this makes it much harder to read on narrow-width screens (e.g. mobile), where the use must scroll horizontally
dajtxx
The 5 cm example had a line break between the 5 and the cm when I read the page in my phone. A joke?