Extending native utilities safely #19808
Replies: 2 comments
-
|
Oh, figured it out myself :) @layer base {
.underline {
text-decoration-thickness: from-font;
}
} |
Beta Was this translation helpful? Give feedback.
-
|
Yes, you can do this cleanly in Tailwind v4 using the base layer to extend the existing @layer base {
.underline {
text-decoration-thickness: from-font;
}
}By placing the override in the So in practice: <!-- Gets underline + decoration-thickness: from-font -->
<span class="underline">Default from-font</span>
<!-- Gets underline + decoration-thickness: 4px (overrides from-font) -->
<span class="underline decoration-4">Explicit 4px</span>This works because Avoid using |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to extend the native
underlineutility class to also applytext-decoration-thickness: from-font(or@apply decoration-from-font), while still being able to override this with other utilities (likedecoration-4) in my markup later. Is this possible?Beta Was this translation helpful? Give feedback.
All reactions