Reputation: 305
I'm in Visual Studio and it's not recognizing the keyword "font" in the expression "@font-face". It's a mature HTML MVC app with all kinds of functionality, but when I tried to add the following code to load a custom font, it's not recognized.
<style type="text/css">
@font-face {
font-family:comic;
src:url(test.eot);
}
</style>
Tooltip error message:
The name 'font' does not exist in the current context
Upvotes: 13
Views: 7585
Reputation: 27
1.Create a CSS file for example "Fonts.css"
2.Drag your fonts you need to include to your project to "Fonts.css"
3.Include the "Fonts.css" in your View
َAnd try to add fonts
This is one of the ways that I think can help you
Upvotes: 1
Reputation: 586
"Razor examines the content on the right-hand side of any @ character and attempts to determine whether it is C# code (if it is a CSHTML file).
In cases where the content is valid as code as well (and you want to treat it as content), you can explicitly escape out @ characters by typing @@."
http://weblogs.asp.net/scottgu/introducing-razor
Add @@ instead of @ in .cshtml file for font-face.
Upvotes: 23