# Custom fonts path in CSS

**URL:** <https://community.hubspot.com/t/custom-fonts-path-in-css/105008>\
**Category:** CMS Development\
**Tags:** css\
**Created:** [April 17, 2024, 12:22pm UTC](https://community.hubspot.com/t/custom-fonts-path-in-css/105008 "2024-04-17T12:22:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RoFiks](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rofiks/32/202358_2.png) [@RoFiks](https://community.hubspot.com/u/RoFiks)\
**Post date:** [April 17, 2024, 12:22pm UTC](https://community.hubspot.com/t/custom-fonts-path-in-css/105008/1 "2024-04-17T12:22:55Z")

</div>

Hi there,

I’m trying to load custom fonts from a folder in my Hubspot theme in my CSS, but I can’t get it to work. Inside my Hubspot theme I’ve created a folder named “fonts” and added the font files to this folder. In my main.css file (inside a “css” folder), I’ve added the paths for @font-face in many different ways, for example with a relative path “../fonts” or with {{ portal\_asset\_url }}, but or I’m getting a 404 error, or I’m getting a “No 'Acces-Control-Allow-Origin” error.

Hope somebody can help me out how to do this. Thank you so much!

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [April 17, 2024, 1:53pm UTC](https://community.hubspot.com/t/custom-fonts-path-in-css/105008/2 "2024-04-17T13:53:53Z")

</div>

Hi @RoFiks

Have you tried _get\_asset\_url_ instead of _portal\_asset\_url_ ?

We have custom fonts set up on one of our portals and the below setup works fine:

```lia-code-sample
@font-face {
 font-family: "MyCustomFont";
 font-weight: 400;
 font-style: normal;
 src: 
 url( {{ get_asset_url('../fonts/MyCustomFont.woff2') }} ) format('woff2'), 
 url( {{ get_asset_url('../fonts/MyCustomFont.woff') }}) format('woff');
} 

```

---

<div class="post-metadata">

**Author:** ![RoFiks](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rofiks/32/202358_2.png) [@RoFiks](https://community.hubspot.com/u/RoFiks)\
**Post date:** [April 17, 2024, 2:40pm UTC](https://community.hubspot.com/t/custom-fonts-path-in-css/105008/3 "2024-04-17T14:40:07Z")

</div>

Hi @evaldas,

Thank you so much! This is working 🙂 It was my scss compiler that didn’t accept the get\_asset\_url function.

Thanks for your help!
