text: Q:
  
  Url.Content() in Style Sheet?
  
  I have a CSS class that references a background image :
  #content-wrapper
  {
      background: #f7f7f7 url('/Images/bg04.png');
      border-top: solid 1px #fff;
      padding: 45px 0 45px 0;
  }
  
  I've been using MVC4 with Razor for a little while now, and I've gotten used to using @Url.Content() to link to images, other pages, and also documents available on the site.
  However, it doesn't look like this particular helper (or any really) is available outside of .cshtml pages.
  My Question :
  Is there any way to "enable" the use of @Url.Content() on a style sheet?
  
  A:
  
  Not easily, and I haven't run into a situation yet where it is needed since the paths are relative to the stylesheet (not the page, which may change).  Although, instead of using an absolute path like url('/Images/bg04.png') you should use a relative url, like url('../Images/bg04.png')
  So if you store your CSS in ~/content and your images are in ~/images, then all the paths in your stylesheet should begin with ../images/
  
  A:
  
  I have no problems using @Url.Content() internally in the MVC5 Razor <head>'s <style type="text/css"> element:
  
  background: url('@Url.Content("~/Content/Images/logo-bg.jpg")') no-repeat scroll 0 0;
  
  A:
  
  I come across this and it helped me out
  <head>
      <meta charset="utf-8" />
      <meta name="description" content="The content description" />
      <link rel="shortcut icon" href="@Url.Content("~/Content/images/favicon.ico")" />
      <title>@ViewBag.Title</title>
      @RenderSection("css", false)
  </head>
  
  Then in your Index.cshtml use the section to add your css link:
  @section css {
      <link href="@Url.Content("~/css/style.css")" rel="stylesheet"/>
  }
  
  Note that "css" is a unique name for your section and it needs to match. You can also use this section in any view you want. The part you specify within the css section will then be rendered within the head-tag of your html, just where you put the RenderSection placeholder in your _Layout.cshtml.
  
  