-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fluid Typography Option #24480
Comments
This would be neat to consider — also cc @nosolosw @jorgefilipecosta for global styles and theme.json consideration. |
Following the suggestion, I gave in #24250 (comment). I think the attributes where we reference a fontSize, lineHeights, padding, margins, widths, etc... should all be strings (instead of multiple attributes one for values and other for units as we have now in some cases). If tomorrow CSS allows a new font size computation e.g: "font-size: next-size-computation( 10px, 10rm, ...). Themes would be able to use that mechanism right away without us needing to change any line of code (the value would be shown as a raw value). In a future version, we may then include a UI to edit that type of value if we think it has a big usage of is useful for building themes and patterns. |
+1 to that... I started working on a similar approach for column widths (see #24711 (comment)) |
There's some conversation on fluid typography in #34641 as well, and this codepen showcases a CSS only solution that could potentially inspire things here. |
@priethor @jasmussen This was removed from 5.9 project board. Do you think it could make it into 6.0? |
As mentioned above, I've started looking at a backend option for fluid typography based on existing When fluid typography is "activated" in theme.json, we generate The resulting font sizes can be applied to any text block in the editor UI, and the preset CSS vars to any root element or block in theme.json. It's still work in progress as I look at various approaches, and consider the constraints on such functionality for an initial version, taking into consideration future development and (future) backwards compatibility should we change clamp algorithms. I'll add this note to the tracking issue as well. 👍 |
Hi folks! It'd be great to get some feedback on #39529 It's trying to be everything to all, so there's probably some room for self restraint 😄 |
Is there a discussion or issue to extend the
In many themes, the blocks/elements such as |
None that I'm aware of. It seems like a reasonable progression. For now, would be it be acceptable to define them in theme.json? "settings": {
"typography": {
"fluid": true,
"fontSizes": [
{
"size": "1rem",
"slug": "medium",
"name": "Medium"
}
]
}
},
"styles": {
"elements": {
"h1": {
"typography": {
"fontSize": "var(--wp--preset--font-size--medium)"
}
}
},
"blocks": {
"core/post-title": {
"typography": {
"fontSize": "var(--wp--preset--font-size--medium)"
}
}
}
} |
Basic fluid font sizing added in #39529 Closing for now. Feel free to re-open, though I think we could create a new issue for fluid letter spacing and any other fluid typography features that folks think would enhance the functionality. |
Defining all fluid fonts in theme.json settings and using them in blocks definitely works. In the view of better developer experience, I think it would be worth considering to extend the fluid typography to block level. |
I see you've filed an enhancement issue. Thank you @madhusudhand !! 🙇 |
It'd be nice to allow to have fluid typography option so that design would look good on all viewports. This would open the door for designers to make a more bold visual expression that's difficult to do with fixed font size.
@mtias told me about
clamp
https://developer.mozilla.org/en-US/docs/Web/CSS/clamp, and that looks a pretty good solution.Related #23323
The text was updated successfully, but these errors were encountered: