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
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!! you have successfully installed a new font for your vscode editor ...
To change font type purely with HTML, use the CSS font-family property. Set it to the value you want and place it inside a style attribute. Then add this style attribute to an HTML element, like a paragraph, heading, button, or span tag.
The @font-face CSS at-rule specifies a custom font with which to display text; the font can be loaded from either a remote server or a locally-installed font on the user's own computer.
"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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With