Background image issues in a HTML5 emitted by MVC4

2019-06-11 14:30发布

I am working on an mvc4 application and i was trying to put a background image url for an element laying on a masterpage file '_Layout.cshtml' but failed, i am not able to see the background image at all .My image is located in

Images-> master -> test.bmp

I put it like a backgroundimage as shown below

<body>
 <header style="background-image:url(../Images/master/test.bmp);position: relative; top: -20px;width:100% ">
</header>
</bpdy>

Can any body suggest me what went wrong here?

Is there any syntax issue? or background image will not be working in Mvc4 html5 at all

Update

I created an Html page and copied this contents and their in design view i can see the image.Now i really wonder what is going wrong over there

UPDATE

I set height and now it is coming ,but issue is it is not coming in IIS,when i run in visual studio development server it is working fine.What will be the reason any guess?

1条回答
别忘想泡老子
2楼-- · 2019-06-11 15:07

Finally i found solution @Url.Content(~path to image) will fix all kinds of issues

查看更多
登录 后发表回答