Re: [csswg-drafts] [css-flexbox] specify max items in line before wrap even if space is otherwise available (#5925)

I encountered a scenario where a similar setting would be helpful, but for a **minimum number of items**. Specifically, the goal is to start wrapping if there are at least `x` items that together overflow the available space. In this case, as the available space decreases, lines would overflow with `x` items per line.

As @SebastianZ suggested, this could potentially be solved using:

```css
:nth-child(<An+B>) {
  wrap-before: avoid;
}
```

However, [Section 5.3](https://drafts.csswg.org/css-text-4/#wrap-before) of the CSS Text Module Level 4 states:

>**avoid**
>Line breaking is suppressed immediately before/after the box: the UA may only break there if there are no other valid break points in the line. If the text breaks, line-breaking restrictions are honored as for auto. 

This means that breaking is suppressed before `:nth-child(<An+B>)` **only if there are alternative breaking points in the line.**

-- 
GitHub Notification of comment by gitspeaks
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5925#issuecomment-2564852337 using your GitHub account


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

Received on Sunday, 29 December 2024 22:18:37 UTC