开发者

How to Set bg Image in asp.net

开发者 https://www.devze.com 2023-03-28 08:31 出处:网络
i am not able to show bg image on my web page. I have written a css which has the following code: body

i am not able to show bg image on my web page. I have written a css which has the following code:

    body 
{
    background-image:url('E:\WEB WEB WEB WEB\RedRockNoodleBar\RedRockNoodleBar1\RedRockNoodleBar1\Images\outer_bg.jpg');
    background-repeat:repeat-x;
}

The css is applie开发者_开发技巧d in the design view of the master page. when i add a content page and run the program, the web page is empty. and shows nothing. y is it so?


you should put the virtual path to your image in your CSS, not the physical path.

something like

body 
{
    background-image:url('../Images/outer_bg.jpg');
    background-repeat:repeat-x;
}

but it depends on where your CSS file is located relative to your Images folder. Here I'm assuming your web app has a structure like this

---Style (folder)
   \--Stylesheet.css

---Images (folder)
   \--outer_bg.jpg

---Default.aspx


I wouldn't reference the physical location via a drive... what happens If I dont have an E drive?

As you are building a website, you can reference a virtual location of the image, if your E drive location isn't part of your site then create a virtual directory within your site, so that it is.


try

background-image:url('file:///E:/WEB WEB WEB WEB/RedRockNoodleBar/RedRockNoodleBar1/RedRockNoodleBar1/Images/outer_bg.jpg');
0

精彩评论

暂无评论...
验证码 换一张
取 消