How to add a custom font to Tailwind CSS 4 using the CSS configuration #18238
Answered
by
wongjn
ShawnXU0208
asked this question in
Help
-
In Tailwind CSS v4, what is the equivalent way to define a custom font in the CSS config, similar to the following setup in
I tried this in my css, but it doesn't work, the customised font get ignored
|
Beta Was this translation helpful? Give feedback.
Answered by
wongjn
Jun 6, 2025
Replies: 1 comment 3 replies
-
The equivalent would be: @import 'tailwindcss';
@theme {
--font-sans: "MyCustomFont", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
None such approach exists if you want to override said theme token. You can avoid copying if defining a new value:
Also, see #15253 (comment).