Yurich
asked on
Setting background-image in CSS file for ASP.NET application
Hello,
I'm trying to set a background image for one of my pages using css file and for some reason it doesn't work :(
I can do it directly through the body tag:
style="background-image:ur l('Images/ bgdesert.j pg')"
I can do it in the inner css in the header section:
<style type="text/css">
body
{
background-image: url('Images/bgdesert.jpg') ;
}
</style>
But when I add it to the css file, it doesn't work :(
body
{
background-image: url('Images/bgdesert.jpg') ;
}
Everything else in this section (I have other elements, just didn't show them) works fine, but not background-image. Any idea why?
Thanks
I'm trying to set a background image for one of my pages using css file and for some reason it doesn't work :(
I can do it directly through the body tag:
style="background-image:ur
I can do it in the inner css in the header section:
<style type="text/css">
body
{
background-image: url('Images/bgdesert.jpg')
}
</style>
But when I add it to the css file, it doesn't work :(
body
{
background-image: url('Images/bgdesert.jpg')
}
Everything else in this section (I have other elements, just didn't show them) works fine, but not background-image. Any idea why?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or put your image in the app_theme folder and do background-image: url('bgdesert.jpg');
ASKER
doesn't work :(
can you try to create a very simpl project and see if it's going to work - just one page and one image and refer to it from a css file?
Thanks
can you try to create a very simpl project and see if it's going to work - just one page and one image and refer to it from a css file?
Thanks
does the image need to be repeated.. i mean in either x or y coordinates?
check for the path.. if you giving the right path. also give height and width of the image.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
just created one and it worked ok. Just one thing - have you setup the theme in the webpage? You need to either add it to the web.config or you can put it at the top of the page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Theme="Theme1" Inherits="_Default" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
ASKER
OK, thank you guys, found a problem.
There was an inline css, which I used for testing and it was apparently overriding my css file and I also didn't have ../../ thing at the time when I did not have inline css. So all together it didn't work and after I deleted inline css and added ../../ bit to my url path, it started work.
Thanks for your help
There was an inline css, which I used for testing and it was apparently overriding my css file and I also didn't have ../../ thing at the time when I did not have inline css. So all together it didn't work and after I deleted inline css and added ../../ bit to my url path, it started work.
Thanks for your help
ASKER
thank you
ASKER
so it should be background-image: url('../../Images/bgdesert
but still not working, I actually tried ../ and ../../ both, still no good...