1

How to use the @page css in a Asp.net MVC View (.cshtml). Because when I tried, It shows an error message

the 'page' does not exist in the current context

And the below mentioned is the stylesheet I used in the view

<style type="text/css" media="print">
            @page port {size: portrait;}
            @page land {size: portrait;}
            @page {
                 size: 85.60mm 53.98mm;
                 margin-top: 8.65mm;
                 margin-bottom: 5.33mm;
                 margin-left: 4.0mm;
                 margin-right: 4.0mm;
                }
        </style>
2
  • 1
    try with @@ (double) Commented Dec 8, 2015 at 13:26
  • @Arvaan Thank You for response, I ll try Commented Dec 8, 2015 at 13:28

1 Answer 1

7

Razor use '@' as a special character for scripting language, Try with double @@

<style type="text/css" media="print">
    @@page port {size: portrait;}
    @@page land {size: portrait;}
    @@page 
    {
        size: 85.60mm 53.98mm;
        margin-top: 8.65mm;
        margin-bottom: 5.33mm;
        margin-left: 4.0mm;
        margin-right: 4.0mm;
    }
</style>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.