This question already has an answer here:
Background image issues in a HTML5 emitted by MVC4 application
                                
                                    (1个答案)
                                
                        
                                4年前关闭。
            
                    
我有一个用MVC4开发的网站,并且一切正常,直到我在iis中部署它为止。

<style>
        .testt {
            background-image: url("../../Images/master/background-Mid.bmp");
            width: 100%;
            height: 100px;
        }
    </style>

</head>
<body>
 <header style="position: relative; top: -20px ">
     <div class="testt">

        <div style="float:right;width:20%;margin-right:10%"><img src="~/Images/master/Right.bmp" /></div>
        <div style="float:right;width:5%"> <img src="~/Images/master/tstLogo.gif"/></div>
      <div style="float:left;width:5%"> <img src="~/Images/master/Left.bmp" /></div>
         </div>

        </header>


在iis中部署背景图像background-Mid.bmp之后,此处不再显示

最佳答案

最后,我发现解决方案@Url.Content(~path to image)将解决各种问题

10-07 17:22