55
loading...
This website collects cookies to deliver better user experience
Custom fonts allow you to use a beautiful combination of different fonts on your website to improve typography and user experience.
#npm
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
#yarn
yarn add -D tailwindcss@latest postcss@latest autoprefixer@latest
npx tailwindcss init -p
tailwind.config.js
file at the root of your project and It will also create a postcss.config.js
file that includes tailwindcss
and autoprefixer
already configured.globals.css
file inside the styles
directory at the root of your project. Replace the content with the following:@tailwind base;
@tailwind components;
@tailwind utilities;
/public/fonts
folder in your project directory. stylesheet.css
file in the fonts
folder in your public
directory of your project@import url('/fonts/stylesheet.css');
@tailwind base;
@tailwind components;
@tailwind utilities;
@import url('https://fonts.googleapis.com/css2?family=Jomhuria&family=Roboto:wght@300;400&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;
tailwind.config.js
to use the new imported font family, in our case BR Firma,module.exports = {
purge: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {
fontFamily: {
sans: ['BR Firma', 'sans-serif'],
},
},
},
variants: {
extend: {},
},
plugins: [],
};