how to add custom font in asp.net mvc 5

这一生的挚爱 提交于 2019-12-10 17:38:39

问题


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


回答1:


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




回答2:


Download Dense-Regular.ttf file to your computer. Then add this .ttl file to your Asp.net Project's "Font" folder and restart this project. then write font-family: 'Dense'; and Its works perfectly.



来源:https://stackoverflow.com/questions/36389557/how-to-add-custom-font-in-asp-net-mvc-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!