Tuesday, 15 April 2014

CSS URLs within MVCx

To allow CSS URLs to work within an MVC app:
Move your Images folder to the Content folder, and use this in your CSS:
background-image: url(Images/login-box-backg.png) no-repeat left top;
Your folder structure should look like this:
  • Content
    -- Images
    ---- login-box-backg.png
    -- Site.css

Note a leading slash should not be used. All paths then within the CSS URL are relative to the Content folder.

No comments:

Post a comment