School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,125 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,067 people online right now. Registration is fast and FREE... Join Now!




Very Simple Question about CSS

 

Very Simple Question about CSS, CSS background not displaying

Vaune

1 Nov, 2009 - 12:01 PM
Post #1

D.I.C Head
**

Joined: 25 Mar, 2008
Posts: 97



Thanked: 2 times
My Contributions
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:

CODE

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 sad.gif

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: 1 Nov, 2009 - 12:07 PM

User is offlineProfile CardPM
+Quote Post


SixOfEleven

RE: Very Simple Question About CSS

1 Nov, 2009 - 12:07 PM
Post #2

lives.ToCode();
Group Icon

Joined: 18 Oct, 2008
Posts: 3,066



Thanked: 171 times
Dream Kudos: 775
Expert In: C, C#, XNA, Game Programming, Programming Concepts

My Contributions
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.
User is offlineProfile CardPM
+Quote Post

Vaune

RE: Very Simple Question About CSS

1 Nov, 2009 - 12:13 PM
Post #3

D.I.C Head
**

Joined: 25 Mar, 2008
Posts: 97



Thanked: 2 times
My Contributions
QUOTE(SixOfEleven @ 1 Nov, 2009 - 12: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.



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!
User is offlineProfile CardPM
+Quote Post

thehat

RE: Very Simple Question About CSS

2 Nov, 2009 - 01:40 AM
Post #4

awake ? web();
Group Icon

Joined: 28 Feb, 2008
Posts: 940



Thanked: 99 times
Dream Kudos: 200
My Contributions
You don't need any kind of speech marks around the file name in css:
CODE

background: #133b6b url(/Images/background.jpg) repeat-x;

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 02:22PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month