IssueRaiser

[css-text] Non-Collapsible Space

HTML whitespace collapsing behavior makes it very difficult to directly manage individual spaces rendered in an HTML document. Whitespace collapsing has a few problems today: 1. Content management systems cannot just blindly pass text written by a non-developer through to an HTML rendering context. If a user types `Hello, World` in a CMS system, it will be rendered as `Hello, World` in HTML. The CMS can't really do anything about this to get the document to render as intended by the author without forcing all strings to use `white-space: pre;`. 1. `white-space: pre;` applies to the whole element, but the user might want two spaces in a particular place within that element. For example, maybe I'm one of those people who insists on two spaces at the end of every sentence. 1. ` ` sounds like an easy fix for "Just add a space here", but forces non-breaking and a forced-width behavior the user may not want (when line wrapped, ` ` always takes up one space of width, even when that's not needed). See the line wrapping behavior of [this demo](https://stackblitz.com/edit/vitejs-vite-datbwc?file=index.html&terminal=dev) as the viewport shrinks. 1. ` ` is the unnamed entity for a single space, which sounds like it would be a good alternative given that I really want the behavior for a simple space. However, ` ` is also subject to whitespace collapsing so it can't really solve this kind of problem. This feels especially weird since whitespace collapsing exists as

Posted by dgp1130 on Sep 2, 2024, 9:37 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments

ux (Other)

[css-text] Non-Collapsible Space

dgp1130Sep 2, 2024, 9:37 PM

HTML whitespace collapsing behavior makes it very difficult to directly manage individual spaces rendered in an HTML document. Whitespace collapsing has a few problems today: 1. Content management systems cannot just blindly pass text written by a non-developer through to an HTML rendering context. If a user types `Hello, World` in a CMS system, it will be rendered as `Hello, World` in HTML. The CMS can't really do anything about this to get the document to render as intended by the author without forcing all strings to use `white-space: pre;`. 1. `white-space: pre;` applies to the whole element, but the user might want two spaces in a particular place within that element. For example, maybe I'm one of those people who insists on two spaces at the end of every sentence. 1. ` ` sounds like an easy fix for "Just add a space here", but forces non-breaking and a forced-width behavior the user may not want (when line wrapped, ` ` always takes up one space of width, even when that's not needed). See the line wrapping behavior of [this demo](https://stackblitz.com/edit/vitejs-vite-datbwc?file=index.html&terminal=dev) as the viewport shrinks. 1. ` ` is the unnamed entity for a single space, which sounds like it would be a good alternative given that I really want the behavior for a simple space. However, ` ` is also subject to whitespace collapsing so it can't really solve this kind of problem. This feels especially weird since whitespace collapsing exists as

Comments (0)

No comments yet. Start the discussion.

Comment on this issue