0

i have a css file that I want to put in my layout. in the web.config file I wrote:

<location path="App_themes/default.css">
          <system.web>
             <authorization>
                <allow users="*"/>
             </authorization>
          </system.web>
       </location>

and in the layout.cshtml I wrote:

 <style>
        h2 {
            color:red;
        }

          @Styles.Render("~/App_themes/css")  

    </style>

but it doesn't recognize the line: @styles.render what should I do?

3 Answers 3

1

See Styles.Render in MVC4.

You need to read-up on Bundling and Minification to get a clear picture of what is going on, but one thing is for certain the @Styles.Render("~/App_Themes/css") call should be done outside of the context of the <style/> tag.

@Styles.Render("~/App_Themes/css")
<style> h2 { color: red; } </style>
Sign up to request clarification or add additional context in comments.

Comments

0

pleas run project in iis project / right Click/ properties/ web/ use local IIS web server

Comments

0

Put @Styles.Render("~/App_Themes/css") inside the head element on your layout page (_Layout.cshtml)

Put the style h2 { color: red; } in your style sheet that lives in theApp_Themes/css subfolder.

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.