Very Simple Question about CSS

CSS background not displaying

Page 1 of 1

3 Replies - 644 Views - Last Post: 02 November 2009 - 02:40 AM

#1 Vaune  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 98
  • Joined: 25-March 08

Very Simple Question about CSS

Post icon  Posted 01 November 2009 - 01:01 PM

Hello everyone,

I'm sure this is a simple oversight on my part, but I can't figure out why my CSS called background won't display.
I'm doing a simple addition to the body tags in an external CSS sheet. I have:

body
{
	margin:0;
	padding:0;
	background: #133b6b url('/Images/background.jpg') repeat-x;
}



I'm using Visual Studio .NET Web Developer 2008 Express Edition as my development environment. When I view the results in Visual Studio's design view, the background shows up fine. However, as soon as I try a web preview, the background is not displayed. I tried 'viewing background image' and it said it was not found.

First and foremost, I know my code is correct. I called the style sheet properly on the page. I tried making the background image its own class and using the <body class="custom"></body> technique and that doesn't work either! I have a basic file system. 'Week 1 Assignment > Images > background.jpg'

I really have no clue why this isn't displaying. I've done this plenty of times and this has never happened before :(

EDIT: The css code snippet is successfully changing the background color, just not displaying the image.

EDIT 2: FIXED by adding ../ before the word Images. Of course it was something simple. Feel free to delete this topic.

This post has been edited by Vaune: 01 November 2009 - 01:07 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Very Simple Question about CSS

#2 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 942
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Very Simple Question about CSS

Posted 01 November 2009 - 01:07 PM

Simple question. One your web server is background.jpg in the Images folder? I've been caught many times by forgetting to create an Images folder and copy the images into it.
Was This Post Helpful? 0
  • +
  • -

#3 Vaune  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 98
  • Joined: 25-March 08

Re: Very Simple Question about CSS

Posted 01 November 2009 - 01:13 PM

View PostSixOfEleven, on 1 Nov, 2009 - 12:07 PM, said:

Simple question. One your web server is background.jpg in the Images folder? I've been caught many times by forgetting to create an Images folder and copy the images into it.



Yes, haha, the image was there. I have been caught by that as well before! It always makes me slightly embarrassed. As it turns out, I just didn't set the path correctly. Thank you for the reply though!
Was This Post Helpful? 0
  • +
  • -

#4 thehat  Icon User is offline

  • awake ? web();
  • member icon

Reputation: 106
  • View blog
  • Posts: 951
  • Joined: 28-February 08

Re: Very Simple Question about CSS

Posted 02 November 2009 - 02:40 AM

You don't need any kind of speech marks around the file name in css:
background: #133b6b url(/Images/background.jpg) repeat-x;


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1