I have the needs to change my fonts to "Helvetica Neue" which is listed on tailwindcss font-sans properties. I managed to change the font, but when I tried to change the font weight, nothing seems to work.
I’ve tried to modify the fontWeight property on tailwind.config.js but even when I used the modified value nothing change. It seems like this problem also exist with other custom fontFamily. So far, fontWeight only works with default font by tailwindcss. Below are my tailwind.config.js code, I have not added anything to the index.css.
/** @type {import('tailwindcss').Config} */
const colors = require('tailwindcss/colors')
module.exports = {
content: ["./index.html",
"./src/*.{jsx,js}",
"./src/**/*.{jsx,js}"],
theme: {
colors: {
'main-blue':'#0066B2',
'secondary-blue':'#4B8EC2',
'background':'#4B8EC2',
'white': colors.white
},
fontFamily: {
'sans': ['"Helvetica Neue"', 'Arial', 'sans-serif']
},
fontWeight: {
'black': '95'
}
},
plugins: [],
}
2
Answers
You’re not using a valid value for
fontWeight
The Docs use the standard CSS values, 100-900.
Example:
Source
95 is not a valid font weight per CSS standards. Font weight starts at 100 (thin).
More information