How to link theme fonts directory in WordPress CSS?

If your theme’s folder structure is similar to the following:

my-theme
 |- index.php
 |- style.css
 |- fonts/font-name.ttf
 |- inc/some-file.php

then the code to connect the font files in your style.css will be:

@font-face {
  font-family: 'Font Name';
  src: url('fonts/font-name.ttf');
}

body{
   font-family: 'Font Name', sans-serif;
}

There shouldn’t be any problem!

tech