Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6137491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:43:59+00:00 2026-05-23T17:43:59+00:00

The CSS3 @font-face rule breaks a Razor section with the error message: CS0103: The

  • 0

The CSS3 @font-face rule breaks a Razor section with the error message: CS0103: The name 'font' does not exist in the current context. It crashes at runtime.

It seems the CSS3 @ character is the problem that causes the Razor parser to fail.

Example:

@section HeadCustomStyleBlock {  
    <style type="text/css">  
        @font-face {  
            font-family: Gentium;
            src: url(http://example.com/fonts/Gentium.ttf);            
        }  
    <style>  
}  

For context, the @section HeadCustomStyleBlock is being included in the Layout page’s <head> element.

Instead of moving this to an external file, can I implement a workaround to keep it inline?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:44:00+00:00Added an answer on May 23, 2026 at 5:44 pm

    As per ScottGu’s blog:

    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/archive/2010/07/02/introducing-razor.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that css3.0 supports the Font-Face tag, correctly in the latest Opera, Safari,
I'm using CSS3 @font-face for web fonts, page looks fine in Firefox and IE
Will I have copyright problems with Microsoft if I add the @font-face CSS3 property
i'm just trying out the new font-face feature in css3 for implementing own ttf/otf
As far as I know that embedding font face is only possible with CSS3
Pages using the Google Font API validate as CSS3, but not as CSS2.1. Here
I am getting two errors in w3 css validtor as Value Error : font-family
I need to change the font weight of part of a CSS3 content selector.
Although this syntax does not render, this is basically what I am attempting to
Google has launched Google font API but, CSS3 standard came with @fontface which enables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.