how to add custom font in asp.net mvc 5

24,275
 <style type="text/css">
@@font-face
 {
    font-family: 'Dense'; 
    src: url('Dense-Regular.ttf'); 
 }
 .classname 
 {
    font-family: 'Dense';
 }
</style>

Cancel @ character. It is a custom character for mvc. To use it inside css use it as @@.

Share:
24,275
myname
Author by

myname

Updated on February 11, 2020

Comments

  • myname
    myname about 4 years

    I am working on a asp.net mvc5 project and I want to add a font to project and I use below code but I dont get proper answer and I need a help .please help me

     <style type="text/css">
        @font-face
         {
            font-family: 'Dense'; 
            src: url('Dense-Regular.ttf'); 
         }
         .classname 
         {
            font-family: 'Dense';
         }
        </style>
    

    and I get this error

    The name 'font' does not exist in the current context