In an effort to establish consistent typography on a website being developed by my team, we have devised custom utility classes in Tailwind. One of these classes, small-italicized
, also requires the text to be italicized. However, it seems that the fontSize
property only allows for lineHeight
, letterSpacing
, and fontWeight
. How can I italicize the small-italicized
text?
tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx}',
'./src/components/**/*.{js,ts,jsx,tsx}',
'./src/shared/components/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {
fontSize: {
'heading-1': ['1.5rem', { fontWeight: 700 }],
'heading-2': ['1.375rem', { fontWeight: 700 }],
'heading-3': ['1.125rem', { fontWeight: 700 }],
'bold-body': ['1rem', { fontWeight: 700 }],
body: ['1rem', { fontWeight: 400 }],
small: ['0.875rem', { fontWeight: 400 }],
'small-italicized': ['0.875rem', { fontWeight: 400 }],
label: ['0.875rem', { fontWeight: 300 }],
'graph-label': ['0.75rem', { fontWeight: 500 }],
'graph-number': ['0.625rem', { fontWeight: 400 }],
},
},
},
plugins: [],
};
I attempted to add a fontStyle
property within the small-italicized
class like this:
'small-italicized': ['0.875rem', { fontWeight: 400, fontStyle: 'italic' }]
Unfortunately, this did not produce the desired font style. I have searched through the Tailwind documentation without finding a solution to this issue.