-
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
Use a default line height #14503
base: next
Are you sure you want to change the base?
Use a default line height #14503
Conversation
5d82786
to
ea3d7fb
Compare
Hey revisiting this again! The biggest blockers for me still are two things:
What are your thoughts? |
Good feedback. I was looking at some alternative approaches, and maybe The only downside is that it does change more line heights for larger font sizes (although you can still set the
PerformanceTo be honest, I'm not sure about the performance impact or even the best way to benchmark it. My intuition is that the function simply calculates a number, which likely isn't any more complex than the approach we're using with I also noticed the main titles on the homepage of commit, pocket, salient, spotlight, studio & syntax actually follow the logic of What do you think about the simplified line height function? |
ea3d7fb
to
fb94048
Compare
What if we just use
And all the upsides mentioned in the PR description. |
@MartijnCuppens Sorry I don't think I was clear enough in my original message — what I'm wondering I guess is if this formula can be written in a way where you could give each number a variable name and it would actually be understandable:
What is Would be awesome to land on something we feel good about here though because I agree it would be really great to get nice automatic line heights even for arbitrary values. |
Well, this is the hard part about these functions indeed. Changing these values is like changing the coeficient and constant in 2 linear equations. Just to find out what these things are doing, you can calculate the matching point with
This means What happens when you for example change These That’s why I suggested using just I'm also unsure about how far we should go with breaking changes to line heights. Do we want to avoid any breaking changes at all costs, or would it be worth it if it significantly simplifies things (and possibly lets us avoid decimals in the named leadings)? |
It might be hard to grasp what Upper part is the current (v3) state, lower part is |
I think there are a few ways we could proceed: 1. Use the long function & remove line heights from the configThis approach uses 2. Use a less complicated function & remove line heights from the configHere, we could use a simpler function like 3. Using
|
This is a slimmer version of #14335, which only includes the default line heights & the
<small>
fix.In this PR:
text-[2.4rem]
will have a calculated line height of2.625rem
, instead of3.6rem
.text-[length:var(--title-font-size)]
).text-[1.5em]
ortext-[larger]
will now use a recalculated line height.lg
(also see Change line height of thelg
font size to1.625rem
#14223).Here's have an overview of which line height will be used for each font size range:
0rem
-.5rem
*1em
.5rem
-1rem
2em - .5rem
1rem
-2rem
1em + .5rem
2rem
-3rem
2em / 3 + 1rem
3rem
1em
* These font sizes are not used in Tailwind by default
Closes #14484, #14223