asp.netimagebackgroundmaster-pages

How do I set a picture as the background in ASP.NET?


I am unable to get the background picture to show in my pages. I am trying to do this in the master page using CSS.

I have a CSS which contains the following:

body {
    background-image: url(../images/background.jpg) no-repeat;
    background-attachment: fixed;
    margin-top: 0px;
}

I know the CSS is being read because all other styles defined in it are working on the .aspx pages... except of course the background image, the background remains white. (This works perfectly fine in .php pages by the way.)

I have been searching online like crazy and all the answers I find, say the above CSS code is the answer... but it is not working!

I am using the following:

Microsoft Visual Studio 2008 Version 9.0.30729.1 SP
Microsoft .NET Framework Version 3.5 SP 1
Firefox Version 3.6.6

If anybody knows how to get this to work, PLEASE let me know!


Solution

  • The CSS background image technique is correct. But have you looked at things in a Http debugger (such as the net monitor in firebug or fiddler) and figured out if your relative pathing isn't screwing the proverbial pooch. Or, CSS paths and ASP.NET and MasterPages sometimes don't quite agree, you probably have an issue of requesting the image from the wrong url so it isn't showing up.