sadeghhp
sadeghhp

Reputation: 702

ASP.NET MVC 3 RAZOR Style

how to use style block in a view ?

@<Style>
...
</Style>

Upvotes: 2

Views: 3773

Answers (2)

Dave
Dave

Reputation: 4414

You have to create a RenderSection in the head of your Layout, then add section to that content in a view. See this article: http://weblogs.asp.net/scottgu/archive/2010/12/30/asp-net-mvc-3-layouts-and-sections-with-razor.aspx

(Hopefully this will help the next Google visitor who gets this unanswered question first.)

Upvotes: 1

Bonshington
Bonshington

Reputation: 4032

style block only valid under <head> tag. if u use master page, just add content template in <head> tag

As the example:

<head>
    <style>
    ...
    </style>
</head>

Upvotes: 1

Related Questions