Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How the hell is this not already a CSS feature?

    font-size: "as-big-as-possible-while-still-fitting-parent-container";
or maybe just

    font-size: max;


i asked this on bluesky (https://bsky.app/profile/swyx.io/post/3lb2x53wuwc2y) and immiediately got this https://kizu.dev/fit-to-width/ which means theres no technical barrier now, we just need the powers that be to prioritize it

anyone with influence on the CSSWG?


Would combine quite well with `text-wrap` actually! [0] That way, the renderer knows the area it needs to fill (the implicit `max-content`, defined width/height, or flex/grid size of the container) and it knows how to best split up the text amongst the lines. Feels like the renderer would be capable of finding the optimal font size to satisfy those two constraints.

[0] https://developer.mozilla.org/en-US/docs/Web/CSS/text-wrap




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: