Skip to content
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

Add line-height modifier for font-size utilities #9875

Merged
merged 10 commits into from
Nov 22, 2022

Conversation

adamwathan
Copy link
Member

@adamwathan adamwathan commented Nov 18, 2022

This PR makes use of generalized modifier support added in v3.2 to add a new line-height modifier to the existing font-size utilities.

This makes it possible to define your font-size and line-height together in a single class for terser code, like you can when using the opacity modifier with color utilities.

<!-- Before -->
<div class="text-lg leading-8">

<!-- Now -->
<div class="text-lg/8">

The potential modifier values are pulled from your lineHeight configuration. You can also use arbitrary values like this:

<!-- Arbitrary line-height modifier -->
<div class="text-xl/[30px]">

<!-- Arbitrary font-size with configured line-height modifier -->
<div class="text-[19px]/7">

<!-- Arbitrary font-size with arbitrary line-height modifier -->
<div class="text-[19px]/[27px]">

The leading-* classes of course aren't going anywhere and are still both useful and supported.

Need to prepare documentation before merging.

@danhollick
Copy link

danhollick commented Feb 24, 2023

@adamwathan just to clarify, is using a relative line-height possible with this modifier?

<!-- Before -->
<div class="text-lg leading-snug">

<!-- Now -->
<div class="text-lg/snug">

Update: it is possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants