-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Use a default line height #14503
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
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
|
|
Hey @MartijnCuppens! First of all: really sorry we didn't get back to you about this earlier. We still really like to figure out a way to clean up these line heights and have talked about this a lot internally but unfortunately weren't able to come to a decision before the v4 release. This, unfortunately, means that we can not do a breaking change like this anymore until we will start work on the v5 release so we'll be closing this PR for now. What we did find out though is that it's possible to implement a line-height function like you are suggesting here in user-space: https://play.tailwindcss.com/quvzc02Vyh?file=css :root {
--tw-leading: round(max(min(2em - 0.5rem, 1em + 0.5rem, 2em / 3 + 1rem), 1em), 2px);
}The only caveat is that you still have to set Sorry, again, for the lack of communications here but we were undecided for a very long time about this one. Hope you understand and thank you a lot for your contribution! |

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 thelgfont 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-1rem2em - .5rem1rem-2rem1em + .5rem2rem-3rem2em / 3 + 1rem3rem1em* These font sizes are not used in Tailwind by default
Closes #14484, #14223