CSS Background-Image refuses to display in ASP.Net MVC

前端 未结 10 922
别那么骄傲
别那么骄傲 2020-12-10 01:14

I am having trouble displaying an background image in my ASP.NET MVC 2 application. Currently, In ~/Views/Shared/Site.master, I set my link to the style sheet to:

         


        
10条回答
  •  盖世英雄少女心
    2020-12-10 01:56

    For anyone experiencing a similar problem with a razor page. You can use your regular CSS form, you just need to play with your folder levels. This avoids having to do CSS inline.

    • Using normal HTML/CSS

      body{background-image: url("images/sparks.jpg");}

    • My folder structure for razor

      body{background-image: url("../../images/sparks.jpg");}

提交回复
热议问题