views:

46

answers:

2

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!

Thanks, Angie

+3  A: 

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.

Wyatt Barnett
So here is the thing I don't get... I did open firebug and there are no errors BUT when I look at the CSS in firebug it is NOT showing the [background-image: url(../images/background.jpg) no-repeat;] line. It shows everything else. It's as if that line of code did not exist but there is NO indication why, no errors, no messages... Any ideas?
Angie
Is the browser using an older cached stylesheet? Is this in a public place where we can look at the rendered result?
David
Thanks to Wyatt Barnett I was able to figure it out. I used firebug to edit the CSS file and discovered the problem. 1. My path was wrong, I changed it from ../images/background.jpg --> ./images/background.jpg 2. The attribute tag was wrong, I changed it from background-image --> backgroundI don't know why I did not think to do this with firebug to start with (it is after all why I have it) so thank you Wyatt for the proverbial slap upside the head - I needed it! :o)
Angie
+1  A: 

Thanks to Wyatt Barnett I was able to figure it out. I used firebug to edit the CSS file and discovered the problem.

  1. My path was wrong, I changed it from ../images/background.jpg --> ./images/background.jpg

  2. The attribute tag was wrong, I changed it from background-image --> background

I don't know why I did not think to do this with firebug to start with (it is after all why I have it) so thank you Wyatt for the proverbial slap upside the head - I needed it! :o)

Angie
make sure you mark Wyatt's answer as accepted.
dave thieben