Open In App

How to add Custom Fonts in a Tailwind CSS Project ?

Adding custom fonts to a Tailwind CSS project involves configuring the fontFamily property within the theme section of the tailwind.config.js file. You can then apply the custom font to specific elements using Tailwind utility classes.

Syntax

// tailwind.config.js

module.exports = {
theme: {
extend: {
fontFamily: {
custom: ['CustomFont', 'sans-serif'],
},
},
},
// Other Tailwind configurations...
};

Here the fontFamily Property configures custom font families within the theme section, specifying the font name and fallbacks.

Key Features

Article Tags :