C#C
C#3y ago
Uchuu

❔ ASP.NET Core Custom Font Not Applied

site.css
body {
  margin-bottom: 60px;
  font-family: Intro, sans-serif;
}

@font-face {
  font-family: Intro;
  src: url("fonts/Intro-Trial-Rg.otf");
}

@font-face {
  font-family: Intro;
  font-weight: bold;
  src: url("fonts/Intro-Trial-Bd.otf");
}

The fonts are copied to the output directory
<ItemGroup>
  <Content Include="..\.dockerignore">
    <Link>.dockerignore</Link>
  </Content>
  <Content Update="wwwroot\fonts\Intro-Trial-Bd.otf">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
  <Content Update="wwwroot\fonts\Intro-Trial-Rg.otf">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
</ItemGroup>

However, the font is not applied to my body. It just falls back to the default. What's wrong?

Folder Structure:
image.png
Was this page helpful?