You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this mode the `fontFamily`, `fontSize`, and `lineHeight` core plugins are replaced, adding custom properties to the output of each which are used in the `calc()` expressions in the utility class.
7
+
8
+
`modern` mode is enabled by default. The previous functionality can be maintained if needed by switching to `classic` mode.
Copy file name to clipboardExpand all lines: README.md
+32-1Lines changed: 32 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,10 @@
8
8
$ npm install --save-dev tailwindcss-capsize
9
9
```
10
10
11
+
## leading-trim?
12
+
13
+
A [proposed CSS property](https://www.w3.org/TR/css-inline-3/#leading-trim) to remove the extra space from text bounding boxes, which affects optical alignment. This [article from Microsoft Design][] outlines the problem and how the proposed solution works.
14
+
11
15
## Configuration
12
16
13
17
This plugin requires a `fontMetrics` key added to your Tailwind theme. It should be an object with keys matching those in your `fontFamily` definitions, and each key should have an object of the following shape:
@@ -52,7 +56,7 @@ module.exports = {
52
56
53
57
## Usage
54
58
55
-
The new `.capsize` utility class should be applied to the _direct parent_ element surrounding a text node. This class only provides the neccessary styles for trimming whitespace, utility classes for setting `font-family`, `font-size`, and `line-height`will need to be applied as well.
59
+
The new `.capsize` utility class should be applied to the _direct parent_ element surrounding a text node. This class requires `font-family`, `font-size`, and `line-height`utilities to be applied at some point above it in the cascade in order for the required custom properties to be available.
56
60
57
61
## Options
58
62
@@ -72,5 +76,32 @@ The default `.capsize` utility class can be replaced with a custom class name if
By default the plugin replaces the `fontFamily`, `fontSize`, and `lineHeight` core plugins, adding custom properties to the output of each which are used in the `calc()` expressions in the utility class.
82
+
83
+
```diff
84
+
.font-sans {
85
+
+ --ascent-scale: 0.9688;
86
+
+ --descent-scale: 0.2415;
87
+
+ --cap-height-scale: 0.7273;
88
+
+ --line-gap-scale: 0;
89
+
+ --line-height-scale: 1.2102;
90
+
font-family: Inter, sans-serif;
91
+
}
92
+
```
93
+
94
+
If you need to support browsers that don’t support custom properties, setting `mode` to `'classic'` will handle all the calculation at build-time before the CSS is output. This will require that the markup matches a specific selector format.
0 commit comments