© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
7 replies
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");
}
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>
<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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ ASP.NET Core ignoring custom DynamicRouteValueTransformer
C#CC# / help
3y ago
❔ ASP.NET to .net Core
C#CC# / help
3y ago
ASP.NET CORE MVC VS ASP.NET CORE WEB API
C#CC# / help
17mo ago