[csswg-drafts] [css-text] Clarify line breaking for atomic inlines within `white-space: nowrap` (#12491)

jja08111 has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-text] Clarify line breaking for atomic inlines within `white-space: nowrap` ==
The specification is unclear whether an atomic inline (e.g., an element with `display: inline-block`) should introduce a line break opportunity when it is within a container that has `white-space: nowrap`.

Currently, browsers exhibit different behaviors, leading to interoperability issues.

[CSS Text Module Level 3](https://www.w3.org/TR/css-text-3/#white-space-property) states for `white-space: nowrap`:
> This value prevents user agents from collapsing sequences of white space. Line feeds are treated as spaces. Lines will only break at <br> elements.

This suggests that no line break should occur around an atomic inline. However, implementations differ.

### Example

Consider the following HTML:
```html
<div style="width: 0; white-space: nowrap;">
unbr<span style="display: inline-block;">oken</span>
</div>
```

Browser Behavior

 * Firefox: Renders "unbroken" on a single line, without a break.
 * Chrome and Safari: Insert a line break before "oken", rendering it as:
```
unbr
oken
```

### Proposal

I'm not sure, but the behavior in Firefox is more intuitive and consistent with the meaning of `white-space: nowrap`. The purpose of nowrap is to prevent line breaks except where explicitly forced.

We propose that the specification be clarified to explicitly state that atomic inlines whether introduce line break opportunities within a `white-space: nowrap` context.

This issue was filed in the Chromium project: [crbug.com/41487390](https://crbug.com/41487390)
And associated pending code changes: https://chromium-review.googlesource.com/c/chromium/src/+/6733701

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12491 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 17 July 2025 06:42:39 UTC