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
Copy file name to clipboardExpand all lines: README.md
+98-12
Original file line number
Diff line number
Diff line change
@@ -155,19 +155,98 @@ This implementation is inspired by [Tailwind CSS’s `css-functions.js`](https:/
155
155
156
156
### Fluid Typography
157
157
158
-
You can also implement [Fluid Typography](https://www.smashingmagazine.com/2022/01/modern-fluid-typography-css-clamp/) as a custom function, using the [`tan(atan2())` technique](https://dev.to/janeori/css-type-casting-to-numeric-tanatan2-scalars-582j) to remove px units and calculate them in CSS.
158
+
You can also implement [Fluid Typography](https://www.smashingmagazine.com/2022/01/modern-fluid-typography-css-clamp/) as a custom function.
Also, by utilizing the [`tan(atan2())` technique](https://dev.to/janeori/css-type-casting-to-numeric-tanatan2-scalars-582j), we can perform calculations in a CSS-native way without requiring JavaScript unit conversions. This means we can combine different units and work with custom properties directly in CSS.
232
+
233
+
> **Note:** Currently, this technique does not work in Firefox.
234
+
235
+
```js
236
+
functiontoPx(length) {
237
+
return`tan(atan2(${length}, 1px))`;
238
+
}
239
+
161
240
functionfluid(
162
-
minSize,
163
-
maxSize,
241
+
min,
242
+
max,
164
243
minBreakpoint='var(--breakpoint-sm)',
165
-
maxBreakpoint='var(--breakpoint-xl)',
244
+
maxBreakpoint='var(--breakpoint-2xl)',
166
245
...rest
167
246
) {
168
-
if (!minSize||!maxSize) {
247
+
if (!min||!max) {
169
248
thrownewError(
170
-
'The --fluid(…) function requires 2–4 arguments, but received none.',
249
+
'The --fluid(…) function requires at least 2 arguments, but received insufficient arguments.',
0 commit comments