Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.
Assuming you have an app configured to use Tailwind CSS, your main CSS file should include Tailwind and your font import.
When using Google Fonts, the @import for the font must come first, before @import "tailwindcss":
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;700;900&display=swap');
@import "tailwindcss";
Then add a base layer to set the default font:
@layer base {
html {
font-family: Inter, system-ui, sans-serif;
}
}
In the end, your CSS file will look like this:
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;700;900&display=swap');
@import "tailwindcss";
@layer base {
html {
font-family: Inter, system-ui, sans-serif;
}
}
Now your default font is set, and you can use font-bold, font-medium, and similar classes to set various weights.