Replies: 3 comments 11 replies
-
|
Up |
Beta Was this translation helpful? Give feedback.
-
|
Warning The
Tip Use this: @theme {
--texttrim-both: trim-both; /* --texttrim or --trim or --ttrim or anything */
--texttrim-start: trim-start;
--texttrim-end: trim-end;
}
@utility text-trim-* {
text-box-trim: --value(--texttrim-*, "none");
}
@utility text-edge-* {
text-box-edge: --value(--textedge-*, "text", "alphabetic", "ideographic", "cap", "ex", [*]);
}
(Original answer) You can easily declare any utility yourself using @theme {
--text-trim-both: trim-both;
--text-trim-start: trim-start;
--text-trim-end: trim-end;
}
@utility text-trim-* {
text-box-trim: --value(--text-trim-*, "none");
}
@utility text-edge-* {
text-box-edge: --value(--text-edge-*, "text", "alphabetic", "ideographic", "cap", "ex", [*]);
}Of course, whether we want to introduce abbreviations depends on the use cases; for example, I would leave out box from the utility name. Edge allows a secondary parameter as well, but this can be handled in arbitrary or supplemented with a modifier. The References: |
Beta Was this translation helpful? Give feedback.
-
|
There's a tailwind plugin you can install instead of defining custom classes yourself!! |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
-
https://developer.mozilla.org/en-US/docs/Web/CSS/text-box
https://caniuse.com/mdn-css_properties_text-box
https://css-tricks.com/two-css-properties-for-trimming-text-box-whitespace/
The support has landed in Safari 18.2 and Chrome 133.
Allows us to align stuff easily with the ascendants, descendants, baseline, etc.
vs
It degrades gracefully on unsupported browsers (a bit uglier layout in rare-ish circumstances).
It is pretty fresh off the release. There aren't really common ways to use it now. The most common proprety combination I've seen is
text-box: trim-both capBeta Was this translation helpful? Give feedback.
All reactions