Re: [csswg-drafts] [css-fonts-4] Feature for making text always fit the width of its parent (#2528)

Ah, I see, thank you for clarifying. The default proposed way this will work is by using the original `font-size` of the element and then increasing it if there is space available. The demos in the CodePen use `<p>` arbitrary, which is unlikely will be a common use case.

The most common use case is to use it for headers, which generally will have their font-size larger than the one for the body text, so their minimal size will be still larger than anything else on the page.

Example: https://codepen.io/kizu/pen/ogNJYbB

<img width="364" alt="A screenshot of a zoomed-in CodePen demo where the header is larger than body text" src="https://github.com/user-attachments/assets/d17f9548-f7ba-4297-bf58-730700062cae" />

I would argue that this is preferable to somehow keeping the largest font-size:

<img width="364" alt="A screenshot of a zoomed-in CodePen demo where the header has a very large font-size, much larger than for the pagrapraphs, with the whole header not fitting into the viewport" src="https://github.com/user-attachments/assets/538f367b-948f-4dfa-b94b-0aaabf4ede44" />

This algorithm will likely work better than existing alternatives that usually don't have a min size defined. And the progressive enhancement story will likely make authors define the initial font-size large enough that it will be readable even at its original size.


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


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

Received on Tuesday, 1 April 2025 18:11:55 UTC