Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add custom font in asp.net mvc 5

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

like image 647
myname Avatar asked Apr 03 '16 18:04

myname


People also ask

How do I add a font to Visual Studio?

In your VS code editor Go to File > Preferences > settings and search font. Insert the name of the newly downloaded font("Fira Code") before other default fonts and voila!!

How do you use font family?

Start with the font you want, and always end with a generic family, to let the browser pick a similar font in the generic family, if no other fonts are available. Note: Separate each value with a comma. Note: If a font name contains white-space, it must be quoted.


1 Answers

 <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 @@.

like image 135
osmanraifgunes Avatar answered Sep 23 '22 21:09

osmanraifgunes