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

前端 未结 10 909
别那么骄傲
别那么骄傲 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:48

    If you use bundles and have the directory structure like :

    -Content
    --lightbox
    ---css
    ----lightbox.css
    ---imgages
    ----close.png
    

    then you can make a separate bundle for content in subdirectories by defining the bundle in that subdirectory:

    bundles.Add(new StyleBundle("~/Content/lightbox/css/bundle")
                    .Include("~/Content/lightbox/css/lightbox.css"));
    
    
    background-image: url(../images/close.png); 
    

提交回复
热议问题