Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
Font in Next.js / Tailwind CSS app initially bold but then unintentionally reverts

I'm working on a pretty bare bones Next app using Tailwind and I just installed a custom variable-weight font Raleway (downloaded the family in .ttf format and converted it to .woff2) but for some reason am unable to change the font weight via the font-bold, font-extrabold, etc custom classes... at least permanently. The Raleway font is successfully showing at all to begin with.

Shown below, a refresh makes the page immediately flash with what's seemingly the correct style but then reverts to something else.

The ephemeral, initially-present bold text upon refreshing.

Could it have something to do with the font block period transitioning to the font swap period? Below is my styles/globals.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
    @font-face {
        font-family: 'Raleway';
        src: url('/fonts/Raleway-Thin.woff2') format('woff2');
        font-weight: 400;
        font-display: swap;
        font-style: normal;
    }
}

And here's my tailwind.config.js:

module.exports = {
  content: [
    './pages/**/*.{js,ts,jsx,tsx}',
    './components/**/*.{js,ts,jsx,tsx}',
  ],
  theme: {
    extend: {
      fontFamily: {
        raleway: ['Raleway', 'sans-serif'],
      },
    },
  },
  plugins: [],
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

it's because the .ttf file you converted only contains the thin weight (font-weight: 100) of the Raleway font. You need all the weight for this to work.

Example for Poppins :

 @font-face {
    font-family: 'Poppins';
    font-weight: 100;
    src: url('../assets/fonts/Poppins/Poppins-Thin.ttf') format('truetype');
}
@font-face {
    font-family: 'Poppins';
    font-weight: 200;
    src: url('../assets/fonts/Poppins/Poppins-ExtraLight.ttf')
        format('truetype');
}
@font-face {
    font-family: 'Poppins';
    font-weight: 300;
    src: url('../assets/fonts/Poppins/Poppins-Light.ttf') format('truetype');
}
...

The flash you see is the default browser font because of the display swap

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!